GoogleURLTrackerInfoBarDelegate: Initialize uninitialized member in constructor.
[chromium-blink-merge.git] / chrome / browser / chrome_content_browser_client.h
blob167ffd01acaf03f2765e2553bc039e2af6389c54
1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_
6 #define CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_
8 #include <set>
9 #include <string>
10 #include <utility>
11 #include <vector>
13 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h"
15 #include "chrome/common/chrome_version_info.h"
16 #include "content/public/browser/content_browser_client.h"
18 #if defined(OS_ANDROID)
19 #include "base/memory/scoped_ptr.h"
20 #endif
22 namespace base {
23 class CommandLine;
26 namespace content {
27 class QuotaPermissionContext;
30 namespace extensions {
31 class BrowserPermissionsPolicyDelegate;
34 namespace prerender {
35 class PrerenderTracker;
38 namespace user_prefs {
39 class PrefRegistrySyncable;
42 namespace chrome {
44 class ChromeContentBrowserClient : public content::ContentBrowserClient {
45 public:
46 ChromeContentBrowserClient();
47 virtual ~ChromeContentBrowserClient();
49 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
51 // Notification that the application locale has changed. This allows us to
52 // update our I/O thread cache of this value.
53 static void SetApplicationLocale(const std::string& locale);
55 virtual content::BrowserMainParts* CreateBrowserMainParts(
56 const content::MainFunctionParams& parameters) OVERRIDE;
57 virtual std::string GetStoragePartitionIdForSite(
58 content::BrowserContext* browser_context,
59 const GURL& site) OVERRIDE;
60 virtual bool IsValidStoragePartitionId(
61 content::BrowserContext* browser_context,
62 const std::string& partition_id) OVERRIDE;
63 virtual void GetStoragePartitionConfigForSite(
64 content::BrowserContext* browser_context,
65 const GURL& site,
66 bool can_be_default,
67 std::string* partition_domain,
68 std::string* partition_name,
69 bool* in_memory) OVERRIDE;
70 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
71 content::WebContents* web_contents) OVERRIDE;
72 virtual void GuestWebContentsCreated(
73 int guest_instance_id,
74 content::SiteInstance* guest_site_instance,
75 content::WebContents* guest_web_contents,
76 content::WebContents* opener_web_contents,
77 content::BrowserPluginGuestDelegate** guest_delegate,
78 scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE;
79 virtual void GuestWebContentsAttached(
80 content::WebContents* guest_web_contents,
81 content::WebContents* embedder_web_contents,
82 const base::DictionaryValue& extra_params) OVERRIDE;
83 virtual void RenderProcessWillLaunch(
84 content::RenderProcessHost* host) OVERRIDE;
85 virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
86 const GURL& effective_url) OVERRIDE;
87 virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
88 const GURL& url) OVERRIDE;
89 virtual void GetAdditionalWebUISchemes(
90 std::vector<std::string>* additional_schemes) OVERRIDE;
91 virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck(
92 std::vector<std::string>* hosts) OVERRIDE;
93 virtual net::URLRequestContextGetter* CreateRequestContext(
94 content::BrowserContext* browser_context,
95 content::ProtocolHandlerMap* protocol_handlers,
96 content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE;
97 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
98 content::BrowserContext* browser_context,
99 const base::FilePath& partition_path,
100 bool in_memory,
101 content::ProtocolHandlerMap* protocol_handlers,
102 content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE;
103 virtual bool IsHandledURL(const GURL& url) OVERRIDE;
104 virtual bool CanCommitURL(content::RenderProcessHost* process_host,
105 const GURL& url) OVERRIDE;
106 virtual bool ShouldAllowOpenURL(content::SiteInstance* site_instance,
107 const GURL& url) OVERRIDE;
108 virtual bool IsSuitableHost(content::RenderProcessHost* process_host,
109 const GURL& site_url) OVERRIDE;
110 virtual bool MayReuseHost(content::RenderProcessHost* process_host) OVERRIDE;
111 virtual bool ShouldTryToUseExistingProcessHost(
112 content::BrowserContext* browser_context, const GURL& url) OVERRIDE;
113 virtual void SiteInstanceGotProcess(
114 content::SiteInstance* site_instance) OVERRIDE;
115 virtual void SiteInstanceDeleting(content::SiteInstance* site_instance)
116 OVERRIDE;
117 virtual void WorkerProcessCreated(content::SiteInstance* site_instance,
118 int worker_process_id) OVERRIDE;
119 virtual void WorkerProcessTerminated(content::SiteInstance* site_instance,
120 int worker_process_id) OVERRIDE;
121 virtual bool ShouldSwapBrowsingInstancesForNavigation(
122 content::SiteInstance* site_instance,
123 const GURL& current_url,
124 const GURL& new_url) OVERRIDE;
125 virtual bool ShouldSwapProcessesForRedirect(
126 content::ResourceContext* resource_context,
127 const GURL& current_url,
128 const GURL& new_url) OVERRIDE;
129 virtual bool ShouldAssignSiteForURL(const GURL& url) OVERRIDE;
130 virtual std::string GetCanonicalEncodingNameByAliasName(
131 const std::string& alias_name) OVERRIDE;
132 virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
133 int child_process_id) OVERRIDE;
134 virtual std::string GetApplicationLocale() OVERRIDE;
135 virtual std::string GetAcceptLangs(
136 content::BrowserContext* context) OVERRIDE;
137 virtual gfx::ImageSkia* GetDefaultFavicon() OVERRIDE;
138 virtual bool AllowAppCache(const GURL& manifest_url,
139 const GURL& first_party,
140 content::ResourceContext* context) OVERRIDE;
141 virtual bool AllowGetCookie(const GURL& url,
142 const GURL& first_party,
143 const net::CookieList& cookie_list,
144 content::ResourceContext* context,
145 int render_process_id,
146 int render_frame_id) OVERRIDE;
147 virtual bool AllowSetCookie(const GURL& url,
148 const GURL& first_party,
149 const std::string& cookie_line,
150 content::ResourceContext* context,
151 int render_process_id,
152 int render_frame_id,
153 net::CookieOptions* options) OVERRIDE;
154 virtual bool AllowSaveLocalState(content::ResourceContext* context) OVERRIDE;
155 virtual bool AllowWorkerDatabase(
156 const GURL& url,
157 const base::string16& name,
158 const base::string16& display_name,
159 unsigned long estimated_size,
160 content::ResourceContext* context,
161 const std::vector<std::pair<int, int> >& render_frames) OVERRIDE;
162 virtual bool AllowWorkerFileSystem(
163 const GURL& url,
164 content::ResourceContext* context,
165 const std::vector<std::pair<int, int> >& render_frames) OVERRIDE;
166 virtual bool AllowWorkerIndexedDB(
167 const GURL& url,
168 const base::string16& name,
169 content::ResourceContext* context,
170 const std::vector<std::pair<int, int> >& render_frames) OVERRIDE;
171 virtual net::URLRequestContext* OverrideRequestContextForURL(
172 const GURL& url, content::ResourceContext* context) OVERRIDE;
173 virtual content::QuotaPermissionContext*
174 CreateQuotaPermissionContext() OVERRIDE;
175 virtual void AllowCertificateError(
176 int render_process_id,
177 int render_frame_id,
178 int cert_error,
179 const net::SSLInfo& ssl_info,
180 const GURL& request_url,
181 ResourceType::Type resource_type,
182 bool overridable,
183 bool strict_enforcement,
184 const base::Callback<void(bool)>& callback,
185 content::CertificateRequestResultType* request) OVERRIDE;
186 virtual void SelectClientCertificate(
187 int render_process_id,
188 int render_frame_id,
189 const net::HttpNetworkSession* network_session,
190 net::SSLCertRequestInfo* cert_request_info,
191 const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE;
192 virtual void AddCertificate(
193 net::URLRequest* request,
194 net::CertificateMimeType cert_type,
195 const void* cert_data,
196 size_t cert_size,
197 int render_process_id,
198 int render_view_id) OVERRIDE;
199 virtual content::MediaObserver* GetMediaObserver() OVERRIDE;
200 virtual void RequestDesktopNotificationPermission(
201 const GURL& source_origin,
202 content::RenderFrameHost* render_frame_host,
203 const base::Closure& callback) OVERRIDE;
204 virtual blink::WebNotificationPresenter::Permission
205 CheckDesktopNotificationPermission(
206 const GURL& source_origin,
207 content::ResourceContext* context,
208 int render_process_id) OVERRIDE;
209 virtual void ShowDesktopNotification(
210 const content::ShowDesktopNotificationHostMsgParams& params,
211 content::RenderFrameHost* render_frame_host,
212 content::DesktopNotificationDelegate* delegate,
213 base::Closure* cancel_callback) OVERRIDE;
214 virtual bool CanCreateWindow(const GURL& opener_url,
215 const GURL& opener_top_level_frame_url,
216 const GURL& source_origin,
217 WindowContainerType container_type,
218 const GURL& target_url,
219 const content::Referrer& referrer,
220 WindowOpenDisposition disposition,
221 const blink::WebWindowFeatures& features,
222 bool user_gesture,
223 bool opener_suppressed,
224 content::ResourceContext* context,
225 int render_process_id,
226 int opener_id,
227 bool* no_javascript_access) OVERRIDE;
228 virtual std::string GetWorkerProcessTitle(
229 const GURL& url, content::ResourceContext* context) OVERRIDE;
230 virtual void ResourceDispatcherHostCreated() OVERRIDE;
231 virtual content::SpeechRecognitionManagerDelegate*
232 GetSpeechRecognitionManagerDelegate() OVERRIDE;
233 virtual net::NetLog* GetNetLog() OVERRIDE;
234 virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
235 virtual bool IsFastShutdownPossible() OVERRIDE;
236 virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh,
237 const GURL& url,
238 WebPreferences* prefs) OVERRIDE;
239 virtual void UpdateInspectorSetting(content::RenderViewHost* rvh,
240 const std::string& key,
241 const std::string& value) OVERRIDE;
242 virtual void BrowserURLHandlerCreated(
243 content::BrowserURLHandler* handler) OVERRIDE;
244 virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE;
245 virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE;
246 virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE;
247 virtual std::string GetDefaultDownloadName() OVERRIDE;
248 virtual void DidCreatePpapiPlugin(
249 content::BrowserPpapiHost* browser_host) OVERRIDE;
250 virtual content::BrowserPpapiHost* GetExternalBrowserPpapiHost(
251 int plugin_process_id) OVERRIDE;
252 virtual bool AllowPepperSocketAPI(
253 content::BrowserContext* browser_context,
254 const GURL& url,
255 bool private_api,
256 const content::SocketPermissionRequest* params) OVERRIDE;
257 virtual ui::SelectFilePolicy* CreateSelectFilePolicy(
258 content::WebContents* web_contents) OVERRIDE;
259 virtual void GetAdditionalAllowedSchemesForFileSystem(
260 std::vector<std::string>* additional_schemes) OVERRIDE;
261 virtual void GetURLRequestAutoMountHandlers(
262 std::vector<fileapi::URLRequestAutoMountHandler>* handlers) OVERRIDE;
263 virtual void GetAdditionalFileSystemBackends(
264 content::BrowserContext* browser_context,
265 const base::FilePath& storage_partition_path,
266 ScopedVector<fileapi::FileSystemBackend>* additional_backends) OVERRIDE;
267 virtual content::DevToolsManagerDelegate*
268 GetDevToolsManagerDelegate() OVERRIDE;
270 #if defined(OS_POSIX) && !defined(OS_MACOSX)
271 virtual void GetAdditionalMappedFilesForChildProcess(
272 const base::CommandLine& command_line,
273 int child_process_id,
274 std::vector<content::FileDescriptorInfo>* mappings) OVERRIDE;
275 #endif
276 #if defined(OS_WIN)
277 virtual const wchar_t* GetResourceDllName() OVERRIDE;
278 virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy,
279 bool* success) OVERRIDE;
280 #endif
282 virtual bool IsPluginAllowedToCallRequestOSFileHandle(
283 content::BrowserContext* browser_context,
284 const GURL& url) OVERRIDE;
286 virtual bool IsPluginAllowedToUseDevChannelAPIs() OVERRIDE;
288 virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
289 int render_process_id) OVERRIDE;
291 private:
292 #if defined(ENABLE_WEBRTC)
293 // Copies disable WebRTC encryption switch depending on the channel.
294 static void MaybeCopyDisableWebRtcEncryptionSwitch(
295 base::CommandLine* to_command_line,
296 const base::CommandLine& from_command_line,
297 VersionInfo::Channel channel);
298 #endif
300 #if defined(ENABLE_PLUGINS)
301 // Set of origins that can use TCP/UDP private APIs from NaCl.
302 std::set<std::string> allowed_socket_origins_;
303 // Set of origins that can get a handle for FileIO from NaCl.
304 std::set<std::string> allowed_file_handle_origins_;
305 #endif
306 scoped_ptr<extensions::BrowserPermissionsPolicyDelegate>
307 permissions_policy_delegate_;
309 // The prerender tracker used to determine whether a render process is used
310 // for prerendering and an override cookie store must be provided.
311 // This needs to be kept as a member rather than just looked up from
312 // the profile due to initialization ordering, as well as due to threading.
313 // It is initialized on the UI thread when the ResoureDispatcherHost is
314 // created. It is used only the IO thread.
315 prerender::PrerenderTracker* prerender_tracker_;
317 friend class DisableWebRtcEncryptionFlagTest;
319 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClient);
322 } // namespace chrome
324 #endif // CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_