OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/breakpad_mac.h" | 8 #include "chrome/app/breakpad_mac.h" |
9 #include "chrome/browser/browser_about_handler.h" | 9 #include "chrome/browser/browser_about_handler.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { | 86 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { |
87 // Note that due to GetEffectiveURL(), even hosted apps will have a | 87 // Note that due to GetEffectiveURL(), even hosted apps will have a |
88 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. | 88 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. |
89 SiteInstance* site_instance = render_view_host->site_instance(); | 89 SiteInstance* site_instance = render_view_host->site_instance(); |
90 const GURL& site = site_instance->site(); | 90 const GURL& site = site_instance->site(); |
91 | 91 |
92 if (!site.SchemeIs(chrome::kExtensionScheme)) | 92 if (!site.SchemeIs(chrome::kExtensionScheme)) |
93 return; | 93 return; |
94 | 94 |
95 Profile* profile = site_instance->browsing_instance()->profile(); | 95 Profile* profile = Profile::FromBrowserContext( |
| 96 site_instance->browsing_instance()->browser_context()); |
96 ExtensionService* service = profile->GetExtensionService(); | 97 ExtensionService* service = profile->GetExtensionService(); |
97 if (!service) | 98 if (!service) |
98 return; | 99 return; |
99 | 100 |
100 ExtensionProcessManager* process_manager = | 101 ExtensionProcessManager* process_manager = |
101 profile->GetExtensionProcessManager(); | 102 profile->GetExtensionProcessManager(); |
102 CHECK(process_manager); | 103 CHECK(process_manager); |
103 | 104 |
104 // This can happen if somebody typos a chrome-extension:// URL. | 105 // This can happen if somebody typos a chrome-extension:// URL. |
105 const Extension* extension = service->GetExtensionByURL(site); | 106 const Extension* extension = service->GetExtensionByURL(site); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 type == Extension::TYPE_USER_SCRIPT || | 140 type == Extension::TYPE_USER_SCRIPT || |
140 type == Extension::TYPE_PACKAGED_APP || | 141 type == Extension::TYPE_PACKAGED_APP || |
141 (type == Extension::TYPE_HOSTED_APP && | 142 (type == Extension::TYPE_HOSTED_APP && |
142 extension->location() == Extension::COMPONENT)) { | 143 extension->location() == Extension::COMPONENT)) { |
143 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); | 144 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); |
144 render_view_host->AllowBindings(BindingsPolicy::EXTENSION); | 145 render_view_host->AllowBindings(BindingsPolicy::EXTENSION); |
145 } | 146 } |
146 } | 147 } |
147 | 148 |
148 // Handles rewriting Web UI URLs. | 149 // Handles rewriting Web UI URLs. |
149 static bool HandleWebUI(GURL* url, Profile* profile) { | 150 static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { |
150 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, *url)) | 151 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url)) |
151 return false; | 152 return false; |
152 | 153 |
153 // Special case the new tab page. In older versions of Chrome, the new tab | 154 // Special case the new tab page. In older versions of Chrome, the new tab |
154 // page was hosted at chrome-internal:<blah>. This might be in people's saved | 155 // page was hosted at chrome-internal:<blah>. This might be in people's saved |
155 // sessions or bookmarks, so we say any URL with that scheme triggers the new | 156 // sessions or bookmarks, so we say any URL with that scheme triggers the new |
156 // tab page. | 157 // tab page. |
157 if (url->SchemeIs(chrome::kChromeInternalScheme)) { | 158 if (url->SchemeIs(chrome::kChromeInternalScheme)) { |
158 // Rewrite it with the proper new tab URL. | 159 // Rewrite it with the proper new tab URL. |
159 *url = GURL(chrome::kChromeUINewTabURL); | 160 *url = GURL(chrome::kChromeUINewTabURL); |
160 } | 161 } |
(...skipping 10 matching lines...) Expand all Loading... |
171 new ChromeRenderViewHostObserver(render_view_host); | 172 new ChromeRenderViewHostObserver(render_view_host); |
172 new DevToolsHandler(render_view_host); | 173 new DevToolsHandler(render_view_host); |
173 new ExtensionMessageHandler(render_view_host); | 174 new ExtensionMessageHandler(render_view_host); |
174 | 175 |
175 InitRenderViewHostForExtensions(render_view_host); | 176 InitRenderViewHostForExtensions(render_view_host); |
176 } | 177 } |
177 | 178 |
178 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( | 179 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( |
179 BrowserRenderProcessHost* host) { | 180 BrowserRenderProcessHost* host) { |
180 int id = host->id(); | 181 int id = host->id(); |
181 Profile* profile = host->profile(); | 182 Profile* profile = Profile::FromBrowserContext(host->browser_context()); |
182 host->channel()->AddFilter(new ChromeRenderMessageFilter( | 183 host->channel()->AddFilter(new ChromeRenderMessageFilter( |
183 id, profile, profile->GetRequestContextForRenderProcess(id))); | 184 id, profile, profile->GetRequestContextForRenderProcess(id))); |
184 host->channel()->AddFilter(new PrintingMessageFilter()); | 185 host->channel()->AddFilter(new PrintingMessageFilter()); |
185 host->channel()->AddFilter( | 186 host->channel()->AddFilter( |
186 new SearchProviderInstallStateMessageFilter(id, profile)); | 187 new SearchProviderInstallStateMessageFilter(id, profile)); |
187 host->channel()->AddFilter(new SpellCheckMessageFilter(id)); | 188 host->channel()->AddFilter(new SpellCheckMessageFilter(id)); |
188 #if defined(OS_MACOSX) | 189 #if defined(OS_MACOSX) |
189 host->channel()->AddFilter(new TextInputClientMessageFilter(host->id())); | 190 host->channel()->AddFilter(new TextInputClientMessageFilter(host->id())); |
190 #endif | 191 #endif |
191 | 192 |
192 host->Send(new ViewMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); | 193 host->Send(new ViewMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); |
193 } | 194 } |
194 | 195 |
195 void ChromeContentBrowserClient::PluginProcessHostCreated( | 196 void ChromeContentBrowserClient::PluginProcessHostCreated( |
196 PluginProcessHost* host) { | 197 PluginProcessHost* host) { |
197 host->AddFilter(new ChromePluginMessageFilter(host)); | 198 host->AddFilter(new ChromePluginMessageFilter(host)); |
198 } | 199 } |
199 | 200 |
200 void ChromeContentBrowserClient::WorkerProcessHostCreated( | 201 void ChromeContentBrowserClient::WorkerProcessHostCreated( |
201 WorkerProcessHost* host) { | 202 WorkerProcessHost* host) { |
202 host->AddFilter(new ChromeWorkerMessageFilter(host)); | 203 host->AddFilter(new ChromeWorkerMessageFilter(host)); |
203 } | 204 } |
204 | 205 |
205 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { | 206 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { |
206 return ChromeWebUIFactory::GetInstance(); | 207 return ChromeWebUIFactory::GetInstance(); |
207 } | 208 } |
208 | 209 |
209 GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile, | 210 GURL ChromeContentBrowserClient::GetEffectiveURL( |
210 const GURL& url) { | 211 content::BrowserContext* browser_context, const GURL& url) { |
| 212 Profile* profile = Profile::FromBrowserContext(browser_context); |
211 // Get the effective URL for the given actual URL. If the URL is part of an | 213 // Get the effective URL for the given actual URL. If the URL is part of an |
212 // installed app, the effective URL is an extension URL with the ID of that | 214 // installed app, the effective URL is an extension URL with the ID of that |
213 // extension as the host. This has the effect of grouping apps together in | 215 // extension as the host. This has the effect of grouping apps together in |
214 // a common SiteInstance. | 216 // a common SiteInstance. |
215 if (!profile || !profile->GetExtensionService()) | 217 if (!profile || !profile->GetExtensionService()) |
216 return url; | 218 return url; |
217 | 219 |
218 const Extension* extension = | 220 const Extension* extension = |
219 profile->GetExtensionService()->GetExtensionByWebExtent(url); | 221 profile->GetExtensionService()->GetExtensionByWebExtent(url); |
220 if (!extension) | 222 if (!extension) |
221 return url; | 223 return url; |
222 | 224 |
223 // If the URL is part of an extension's web extent, convert it to an | 225 // If the URL is part of an extension's web extent, convert it to an |
224 // extension URL. | 226 // extension URL. |
225 return extension->GetResourceURL(url.path()); | 227 return extension->GetResourceURL(url.path()); |
226 } | 228 } |
227 | 229 |
228 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( | 230 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( |
229 Profile* profile, | 231 content::BrowserContext* browser_context, const GURL& effective_url) { |
230 const GURL& effective_url) { | |
231 // Non-extension URLs should generally use process-per-site-instance. | 232 // Non-extension URLs should generally use process-per-site-instance. |
232 // Because we expect to use the effective URL, hosted apps URLs should have | 233 // Because we expect to use the effective URL, hosted apps URLs should have |
233 // an extension scheme by now. | 234 // an extension scheme by now. |
234 if (!effective_url.SchemeIs(chrome::kExtensionScheme)) | 235 if (!effective_url.SchemeIs(chrome::kExtensionScheme)) |
235 return false; | 236 return false; |
236 | 237 |
| 238 Profile* profile = Profile::FromBrowserContext(browser_context); |
237 if (!profile || !profile->GetExtensionService()) | 239 if (!profile || !profile->GetExtensionService()) |
238 return false; | 240 return false; |
239 | 241 |
240 const Extension* extension = | 242 const Extension* extension = |
241 profile->GetExtensionService()->GetExtensionByURL(effective_url); | 243 profile->GetExtensionService()->GetExtensionByURL(effective_url); |
242 if (!extension) | 244 if (!extension) |
243 return false; | 245 return false; |
244 | 246 |
245 // If the URL is part of a hosted app that does not have the background | 247 // If the URL is part of a hosted app that does not have the background |
246 // permission, we want to give each instance its own process to improve | 248 // permission, we want to give each instance its own process to improve |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 297 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
296 #if defined(OS_CHROMEOS) | 298 #if defined(OS_CHROMEOS) |
297 const std::string& login_profile = | 299 const std::string& login_profile = |
298 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); | 300 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); |
299 if (!login_profile.empty()) | 301 if (!login_profile.empty()) |
300 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); | 302 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); |
301 #endif | 303 #endif |
302 | 304 |
303 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); | 305 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); |
304 | 306 |
305 PrefService* prefs = process->profile()->GetPrefs(); | 307 Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
| 308 PrefService* prefs = profile->GetPrefs(); |
306 // Currently this pref is only registered if applied via a policy. | 309 // Currently this pref is only registered if applied via a policy. |
307 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && | 310 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && |
308 prefs->GetBoolean(prefs::kDisable3DAPIs)) { | 311 prefs->GetBoolean(prefs::kDisable3DAPIs)) { |
309 // Turn this policy into a command line switch. | 312 // Turn this policy into a command line switch. |
310 command_line->AppendSwitch(switches::kDisable3DAPIs); | 313 command_line->AppendSwitch(switches::kDisable3DAPIs); |
311 } | 314 } |
312 | 315 |
313 // Disable client-side phishing detection in the renderer if it is disabled | 316 // Disable client-side phishing detection in the renderer if it is disabled |
314 // in the Profile preferences or the browser process. | 317 // in the Profile preferences or the browser process. |
315 if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) || | 318 if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) || |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, | 391 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
389 arraysize(kSwitchNames)); | 392 arraysize(kSwitchNames)); |
390 } | 393 } |
391 } | 394 } |
392 | 395 |
393 std::string ChromeContentBrowserClient::GetApplicationLocale() { | 396 std::string ChromeContentBrowserClient::GetApplicationLocale() { |
394 return g_browser_process->GetApplicationLocale(); | 397 return g_browser_process->GetApplicationLocale(); |
395 } | 398 } |
396 | 399 |
397 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { | 400 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { |
398 return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); | 401 Profile* profile = Profile::FromBrowserContext(tab->browser_context()); |
| 402 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
399 } | 403 } |
400 | 404 |
401 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { | 405 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { |
402 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 406 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
403 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 407 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
404 } | 408 } |
405 | 409 |
406 bool ChromeContentBrowserClient::AllowAppCache( | 410 bool ChromeContentBrowserClient::AllowAppCache( |
407 const GURL& manifest_url, | 411 const GURL& manifest_url, |
408 const content::ResourceContext& context) { | 412 const content::ResourceContext& context) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 int render_process_id, | 571 int render_process_id, |
568 int render_view_id) { | 572 int render_view_id) { |
569 RenderViewHost* rvh = RenderViewHost::FromID( | 573 RenderViewHost* rvh = RenderViewHost::FromID( |
570 render_process_id, render_view_id); | 574 render_process_id, render_view_id); |
571 if (!rvh) { | 575 if (!rvh) { |
572 NOTREACHED(); | 576 NOTREACHED(); |
573 return; | 577 return; |
574 } | 578 } |
575 | 579 |
576 RenderProcessHost* process = rvh->process(); | 580 RenderProcessHost* process = rvh->process(); |
| 581 Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
577 DesktopNotificationService* service = | 582 DesktopNotificationService* service = |
578 DesktopNotificationServiceFactory::GetForProfile(process->profile()); | 583 DesktopNotificationServiceFactory::GetForProfile(profile); |
579 service->RequestPermission( | 584 service->RequestPermission( |
580 source_origin, render_process_id, render_view_id, callback_context, | 585 source_origin, render_process_id, render_view_id, callback_context, |
581 tab_util::GetTabContentsByID(render_process_id, render_view_id)); | 586 tab_util::GetTabContentsByID(render_process_id, render_view_id)); |
582 } | 587 } |
583 | 588 |
584 WebKit::WebNotificationPresenter::Permission | 589 WebKit::WebNotificationPresenter::Permission |
585 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 590 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
586 const GURL& source_url, | 591 const GURL& source_url, |
587 const content::ResourceContext& context) { | 592 const content::ResourceContext& context) { |
588 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 593 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
(...skipping 20 matching lines...) Expand all Loading... |
609 int render_view_id, | 614 int render_view_id, |
610 bool worker) { | 615 bool worker) { |
611 RenderViewHost* rvh = RenderViewHost::FromID( | 616 RenderViewHost* rvh = RenderViewHost::FromID( |
612 render_process_id, render_view_id); | 617 render_process_id, render_view_id); |
613 if (!rvh) { | 618 if (!rvh) { |
614 NOTREACHED(); | 619 NOTREACHED(); |
615 return; | 620 return; |
616 } | 621 } |
617 | 622 |
618 RenderProcessHost* process = rvh->process(); | 623 RenderProcessHost* process = rvh->process(); |
| 624 Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
619 DesktopNotificationService* service = | 625 DesktopNotificationService* service = |
620 DesktopNotificationServiceFactory::GetForProfile(process->profile()); | 626 DesktopNotificationServiceFactory::GetForProfile(profile); |
621 service->ShowDesktopNotification( | 627 service->ShowDesktopNotification( |
622 params, render_process_id, render_view_id, | 628 params, render_process_id, render_view_id, |
623 worker ? DesktopNotificationService::WorkerNotification : | 629 worker ? DesktopNotificationService::WorkerNotification : |
624 DesktopNotificationService::PageNotification); | 630 DesktopNotificationService::PageNotification); |
625 } | 631 } |
626 | 632 |
627 void ChromeContentBrowserClient::CancelDesktopNotification( | 633 void ChromeContentBrowserClient::CancelDesktopNotification( |
628 int render_process_id, | 634 int render_process_id, |
629 int render_view_id, | 635 int render_view_id, |
630 int notification_id) { | 636 int notification_id) { |
631 RenderViewHost* rvh = RenderViewHost::FromID( | 637 RenderViewHost* rvh = RenderViewHost::FromID( |
632 render_process_id, render_view_id); | 638 render_process_id, render_view_id); |
633 if (!rvh) { | 639 if (!rvh) { |
634 NOTREACHED(); | 640 NOTREACHED(); |
635 return; | 641 return; |
636 } | 642 } |
637 | 643 |
638 RenderProcessHost* process = rvh->process(); | 644 RenderProcessHost* process = rvh->process(); |
| 645 Profile* profile = Profile::FromBrowserContext(process->browser_context()); |
639 DesktopNotificationService* service = | 646 DesktopNotificationService* service = |
640 DesktopNotificationServiceFactory::GetForProfile(process->profile()); | 647 DesktopNotificationServiceFactory::GetForProfile(profile); |
641 service->CancelDesktopNotification( | 648 service->CancelDesktopNotification( |
642 render_process_id, render_view_id, notification_id); | 649 render_process_id, render_view_id, notification_id); |
643 } | 650 } |
644 | 651 |
645 bool ChromeContentBrowserClient::CanCreateWindow( | 652 bool ChromeContentBrowserClient::CanCreateWindow( |
646 const GURL& source_url, | 653 const GURL& source_url, |
647 WindowContainerType container_type, | 654 WindowContainerType container_type, |
648 const content::ResourceContext& context) { | 655 const content::ResourceContext& context) { |
649 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 656 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
650 // If the opener is trying to create a background window but doesn't have | 657 // If the opener is trying to create a background window but doesn't have |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 699 |
693 net::NetLog* ChromeContentBrowserClient::GetNetLog() { | 700 net::NetLog* ChromeContentBrowserClient::GetNetLog() { |
694 return g_browser_process->net_log(); | 701 return g_browser_process->net_log(); |
695 } | 702 } |
696 | 703 |
697 bool ChromeContentBrowserClient::IsFastShutdownPossible() { | 704 bool ChromeContentBrowserClient::IsFastShutdownPossible() { |
698 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 705 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
699 return !browser_command_line.HasSwitch(switches::kChromeFrame); | 706 return !browser_command_line.HasSwitch(switches::kChromeFrame); |
700 } | 707 } |
701 | 708 |
702 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(Profile* profile, | 709 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs( |
703 bool is_web_ui) { | 710 content::BrowserContext* browser_context, bool is_web_ui) { |
704 return RenderViewHostDelegateHelper::GetWebkitPrefs(profile, is_web_ui); | 711 return RenderViewHostDelegateHelper::GetWebkitPrefs(browser_context, |
| 712 is_web_ui); |
705 } | 713 } |
706 | 714 |
707 void ChromeContentBrowserClient::UpdateInspectorSetting( | 715 void ChromeContentBrowserClient::UpdateInspectorSetting( |
708 RenderViewHost* rvh, const std::string& key, const std::string& value) { | 716 RenderViewHost* rvh, const std::string& key, const std::string& value) { |
709 RenderViewHostDelegateHelper::UpdateInspectorSetting( | 717 RenderViewHostDelegateHelper::UpdateInspectorSetting( |
710 rvh->process()->profile(), key, value); | 718 rvh->process()->browser_context(), key, value); |
711 } | 719 } |
712 | 720 |
713 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { | 721 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { |
714 RenderViewHostDelegateHelper::ClearInspectorSettings( | 722 RenderViewHostDelegateHelper::ClearInspectorSettings( |
715 rvh->process()->profile()); | 723 rvh->process()->browser_context()); |
716 } | 724 } |
717 | 725 |
718 void ChromeContentBrowserClient::BrowserURLHandlerCreated( | 726 void ChromeContentBrowserClient::BrowserURLHandlerCreated( |
719 BrowserURLHandler* handler) { | 727 BrowserURLHandler* handler) { |
720 // Add the default URL handlers. | 728 // Add the default URL handlers. |
721 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, | 729 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, |
722 BrowserURLHandler::null_handler()); | 730 BrowserURLHandler::null_handler()); |
723 handler->AddHandlerPair(BrowserURLHandler::null_handler(), | 731 handler->AddHandlerPair(BrowserURLHandler::null_handler(), |
724 &ExtensionWebUI::HandleChromeURLOverrideReverse); | 732 &ExtensionWebUI::HandleChromeURLOverrideReverse); |
725 | 733 |
726 // about: | 734 // about: |
727 handler->AddHandlerPair(&WillHandleBrowserAboutURL, | 735 handler->AddHandlerPair(&WillHandleBrowserAboutURL, |
728 BrowserURLHandler::null_handler()); | 736 BrowserURLHandler::null_handler()); |
729 // chrome: & friends. | 737 // chrome: & friends. |
730 handler->AddHandlerPair(&HandleWebUI, | 738 handler->AddHandlerPair(&HandleWebUI, |
731 BrowserURLHandler::null_handler()); | 739 BrowserURLHandler::null_handler()); |
732 } | 740 } |
733 | 741 |
734 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { | 742 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { |
735 Profile* profile = rvh->site_instance()->GetProcess()->profile(); | 743 Profile* profile = Profile::FromBrowserContext( |
| 744 rvh->site_instance()->GetProcess()->browser_context()); |
736 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, | 745 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
737 BrowsingDataRemover::EVERYTHING, | 746 BrowsingDataRemover::EVERYTHING, |
738 base::Time()); | 747 base::Time()); |
739 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); | 748 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); |
740 // BrowsingDataRemover takes care of deleting itself when done. | 749 // BrowsingDataRemover takes care of deleting itself when done. |
741 } | 750 } |
742 | 751 |
743 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { | 752 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { |
744 Profile* profile = rvh->site_instance()->GetProcess()->profile(); | 753 Profile* profile = Profile::FromBrowserContext( |
| 754 rvh->site_instance()->GetProcess()->browser_context()); |
745 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, | 755 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
746 BrowsingDataRemover::EVERYTHING, | 756 BrowsingDataRemover::EVERYTHING, |
747 base::Time()); | 757 base::Time()); |
748 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES; | 758 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES; |
749 remover->Remove(remove_mask); | 759 remover->Remove(remove_mask); |
750 // BrowsingDataRemover takes care of deleting itself when done. | 760 // BrowsingDataRemover takes care of deleting itself when done. |
751 } | 761 } |
752 | 762 |
753 void ChromeContentBrowserClient::GetSaveDir(TabContents* tab_contents, | 763 void ChromeContentBrowserClient::GetSaveDir(TabContents* tab_contents, |
754 FilePath* website_save_dir, | 764 FilePath* website_save_dir, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 #if defined(USE_NSS) | 820 #if defined(USE_NSS) |
811 crypto::CryptoModuleBlockingPasswordDelegate* | 821 crypto::CryptoModuleBlockingPasswordDelegate* |
812 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 822 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
813 const GURL& url) { | 823 const GURL& url) { |
814 return browser::NewCryptoModuleBlockingDialogDelegate( | 824 return browser::NewCryptoModuleBlockingDialogDelegate( |
815 browser::kCryptoModulePasswordKeygen, url.host()); | 825 browser::kCryptoModulePasswordKeygen, url.host()); |
816 } | 826 } |
817 #endif | 827 #endif |
818 | 828 |
819 } // namespace chrome | 829 } // namespace chrome |
OLD | NEW |