Add ICU message format support
[chromium-blink-merge.git] / content / shell / browser / shell_browser_context.h
blob07802ee955e8b4510cefdd2a388e5c1b2e3a0dfa
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/content_browser_client.h"
14 #include "content/public/browser/resource_context.h"
15 #include "content/shell/browser/shell_url_request_context_getter.h"
16 #include "net/url_request/url_request_job_factory.h"
18 namespace net {
19 class NetLog;
22 namespace content {
24 class DownloadManagerDelegate;
25 class PermissionManager;
26 class ShellDownloadManagerDelegate;
27 class ZoomLevelDelegate;
29 class ShellBrowserContext : public BrowserContext {
30 public:
31 ShellBrowserContext(bool off_the_record, net::NetLog* net_log);
32 ~ShellBrowserContext() override;
34 void set_guest_manager_for_testing(
35 BrowserPluginGuestManager* guest_manager) {
36 guest_manager_ = guest_manager;
39 // BrowserContext implementation.
40 base::FilePath GetPath() const override;
41 scoped_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate(
42 const base::FilePath& partition_path) override;
43 bool IsOffTheRecord() const override;
44 DownloadManagerDelegate* GetDownloadManagerDelegate() override;
45 net::URLRequestContextGetter* GetRequestContext() override;
46 net::URLRequestContextGetter* GetRequestContextForRenderProcess(
47 int renderer_child_id) override;
48 net::URLRequestContextGetter* GetMediaRequestContext() override;
49 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
50 int renderer_child_id) override;
51 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition(
52 const base::FilePath& partition_path,
53 bool in_memory) override;
54 ResourceContext* GetResourceContext() override;
55 BrowserPluginGuestManager* GetGuestManager() override;
56 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
57 PushMessagingService* GetPushMessagingService() override;
58 SSLHostStateDelegate* GetSSLHostStateDelegate() override;
59 PermissionManager* GetPermissionManager() override;
61 net::URLRequestContextGetter* CreateRequestContext(
62 ProtocolHandlerMap* protocol_handlers,
63 URLRequestInterceptorScopedVector request_interceptors);
64 net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
65 const base::FilePath& partition_path,
66 bool in_memory,
67 ProtocolHandlerMap* protocol_handlers,
68 URLRequestInterceptorScopedVector request_interceptors);
70 protected:
71 // Contains URLRequestContextGetter required for resource loading.
72 class ShellResourceContext : public ResourceContext {
73 public:
74 ShellResourceContext();
75 ~ShellResourceContext() override;
77 // ResourceContext implementation:
78 net::HostResolver* GetHostResolver() override;
79 net::URLRequestContext* GetRequestContext() override;
81 void set_url_request_context_getter(ShellURLRequestContextGetter* getter) {
82 getter_ = getter;
85 private:
86 ShellURLRequestContextGetter* getter_;
88 DISALLOW_COPY_AND_ASSIGN(ShellResourceContext);
91 ShellURLRequestContextGetter* url_request_context_getter() {
92 return url_request_getter_.get();
95 // Used by ShellBrowserContext to initiate and set different types of
96 // URLRequestContextGetter.
97 virtual ShellURLRequestContextGetter* CreateURLRequestContextGetter(
98 ProtocolHandlerMap* protocol_handlers,
99 URLRequestInterceptorScopedVector request_interceptors);
100 void set_url_request_context_getter(ShellURLRequestContextGetter* getter) {
101 url_request_getter_ = getter;
104 bool ignore_certificate_errors() const { return ignore_certificate_errors_; }
105 net::NetLog* net_log() const { return net_log_; }
107 scoped_ptr<ShellResourceContext> resource_context_;
108 bool ignore_certificate_errors_;
109 scoped_ptr<ShellDownloadManagerDelegate> download_manager_delegate_;
110 scoped_ptr<PermissionManager> permission_manager_;
112 private:
113 // Performs initialization of the ShellBrowserContext while IO is still
114 // allowed on the current thread.
115 void InitWhileIOAllowed();
117 bool off_the_record_;
118 net::NetLog* net_log_;
119 base::FilePath path_;
120 BrowserPluginGuestManager* guest_manager_;
121 scoped_refptr<ShellURLRequestContextGetter> url_request_getter_;
123 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext);
126 } // namespace content
128 #endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_