Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase fix Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { 84 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) {
85 // Note that due to GetEffectiveURL(), even hosted apps will have a 85 // Note that due to GetEffectiveURL(), even hosted apps will have a
86 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. 86 // chrome-extension:// URL for their site, so we can ignore that wrinkle here.
87 SiteInstance* site_instance = render_view_host->site_instance(); 87 SiteInstance* site_instance = render_view_host->site_instance();
88 const GURL& site = site_instance->site(); 88 const GURL& site = site_instance->site();
89 89
90 if (!site.SchemeIs(chrome::kExtensionScheme)) 90 if (!site.SchemeIs(chrome::kExtensionScheme))
91 return; 91 return;
92 92
93 Profile* profile = site_instance->browsing_instance()->profile(); 93 Profile* profile = Profile::FromBrowserContext(
94 site_instance->browsing_instance()->browser_context());
94 ExtensionService* service = profile->GetExtensionService(); 95 ExtensionService* service = profile->GetExtensionService();
95 if (!service) 96 if (!service)
96 return; 97 return;
97 98
98 ExtensionProcessManager* process_manager = 99 ExtensionProcessManager* process_manager =
99 profile->GetExtensionProcessManager(); 100 profile->GetExtensionProcessManager();
100 CHECK(process_manager); 101 CHECK(process_manager);
101 102
102 // This can happen if somebody typos a chrome-extension:// URL. 103 // This can happen if somebody typos a chrome-extension:// URL.
103 const Extension* extension = service->GetExtensionByURL(site); 104 const Extension* extension = service->GetExtensionByURL(site);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 type == Extension::TYPE_USER_SCRIPT || 138 type == Extension::TYPE_USER_SCRIPT ||
138 type == Extension::TYPE_PACKAGED_APP || 139 type == Extension::TYPE_PACKAGED_APP ||
139 (type == Extension::TYPE_HOSTED_APP && 140 (type == Extension::TYPE_HOSTED_APP &&
140 extension->location() == Extension::COMPONENT)) { 141 extension->location() == Extension::COMPONENT)) {
141 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); 142 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id()));
142 render_view_host->AllowBindings(BindingsPolicy::EXTENSION); 143 render_view_host->AllowBindings(BindingsPolicy::EXTENSION);
143 } 144 }
144 } 145 }
145 146
146 // Handles rewriting Web UI URLs. 147 // Handles rewriting Web UI URLs.
147 static bool HandleWebUI(GURL* url, Profile* profile) { 148 static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) {
148 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, *url)) 149 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(browser_context, *url))
149 return false; 150 return false;
150 151
151 // Special case the new tab page. In older versions of Chrome, the new tab 152 // Special case the new tab page. In older versions of Chrome, the new tab
152 // page was hosted at chrome-internal:<blah>. This might be in people's saved 153 // page was hosted at chrome-internal:<blah>. This might be in people's saved
153 // sessions or bookmarks, so we say any URL with that scheme triggers the new 154 // sessions or bookmarks, so we say any URL with that scheme triggers the new
154 // tab page. 155 // tab page.
155 if (url->SchemeIs(chrome::kChromeInternalScheme)) { 156 if (url->SchemeIs(chrome::kChromeInternalScheme)) {
156 // Rewrite it with the proper new tab URL. 157 // Rewrite it with the proper new tab URL.
157 *url = GURL(chrome::kChromeUINewTabURL); 158 *url = GURL(chrome::kChromeUINewTabURL);
158 } 159 }
(...skipping 10 matching lines...) Expand all
169 new ChromeRenderViewHostObserver(render_view_host); 170 new ChromeRenderViewHostObserver(render_view_host);
170 new DevToolsHandler(render_view_host); 171 new DevToolsHandler(render_view_host);
171 new ExtensionMessageHandler(render_view_host); 172 new ExtensionMessageHandler(render_view_host);
172 173
173 InitRenderViewHostForExtensions(render_view_host); 174 InitRenderViewHostForExtensions(render_view_host);
174 } 175 }
175 176
176 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( 177 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated(
177 BrowserRenderProcessHost* host) { 178 BrowserRenderProcessHost* host) {
178 int id = host->id(); 179 int id = host->id();
179 Profile* profile = host->profile(); 180 Profile* profile = Profile::FromBrowserContext(host->browser_context());
180 host->channel()->AddFilter(new ChromeRenderMessageFilter( 181 host->channel()->AddFilter(new ChromeRenderMessageFilter(
181 id, profile, profile->GetRequestContextForRenderProcess(id))); 182 id, profile, profile->GetRequestContextForRenderProcess(id)));
182 host->channel()->AddFilter(new PrintingMessageFilter()); 183 host->channel()->AddFilter(new PrintingMessageFilter());
183 host->channel()->AddFilter( 184 host->channel()->AddFilter(
184 new SearchProviderInstallStateMessageFilter(id, profile)); 185 new SearchProviderInstallStateMessageFilter(id, profile));
185 host->channel()->AddFilter(new SpellCheckMessageFilter(id)); 186 host->channel()->AddFilter(new SpellCheckMessageFilter(id));
186 #if defined(OS_MACOSX) 187 #if defined(OS_MACOSX)
187 host->channel()->AddFilter(new TextInputClientMessageFilter(host->id())); 188 host->channel()->AddFilter(new TextInputClientMessageFilter(host->id()));
188 #endif 189 #endif
189 190
190 host->Send(new ViewMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); 191 host->Send(new ViewMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
191 } 192 }
192 193
193 void ChromeContentBrowserClient::PluginProcessHostCreated( 194 void ChromeContentBrowserClient::PluginProcessHostCreated(
194 PluginProcessHost* host) { 195 PluginProcessHost* host) {
195 host->AddFilter(new ChromePluginMessageFilter(host)); 196 host->AddFilter(new ChromePluginMessageFilter(host));
196 } 197 }
197 198
198 void ChromeContentBrowserClient::WorkerProcessHostCreated( 199 void ChromeContentBrowserClient::WorkerProcessHostCreated(
199 WorkerProcessHost* host) { 200 WorkerProcessHost* host) {
200 host->AddFilter(new ChromeWorkerMessageFilter(host)); 201 host->AddFilter(new ChromeWorkerMessageFilter(host));
201 } 202 }
202 203
203 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { 204 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() {
204 return ChromeWebUIFactory::GetInstance(); 205 return ChromeWebUIFactory::GetInstance();
205 } 206 }
206 207
207 GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile, 208 GURL ChromeContentBrowserClient::GetEffectiveURL(
208 const GURL& url) { 209 content::BrowserContext* browser_context, const GURL& url) {
210 Profile* profile = Profile::FromBrowserContext(browser_context);
209 // Get the effective URL for the given actual URL. If the URL is part of an 211 // Get the effective URL for the given actual URL. If the URL is part of an
210 // installed app, the effective URL is an extension URL with the ID of that 212 // installed app, the effective URL is an extension URL with the ID of that
211 // extension as the host. This has the effect of grouping apps together in 213 // extension as the host. This has the effect of grouping apps together in
212 // a common SiteInstance. 214 // a common SiteInstance.
213 if (!profile || !profile->GetExtensionService()) 215 if (!profile || !profile->GetExtensionService())
214 return url; 216 return url;
215 217
216 const Extension* extension = 218 const Extension* extension =
217 profile->GetExtensionService()->GetExtensionByWebExtent(url); 219 profile->GetExtensionService()->GetExtensionByWebExtent(url);
218 if (!extension) 220 if (!extension)
219 return url; 221 return url;
220 222
221 // If the URL is part of an extension's web extent, convert it to an 223 // If the URL is part of an extension's web extent, convert it to an
222 // extension URL. 224 // extension URL.
223 return extension->GetResourceURL(url.path()); 225 return extension->GetResourceURL(url.path());
224 } 226 }
225 227
226 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( 228 bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
227 Profile* profile, 229 content::BrowserContext* browser_context, const GURL& effective_url) {
228 const GURL& effective_url) {
229 // Non-extension URLs should generally use process-per-site-instance. 230 // Non-extension URLs should generally use process-per-site-instance.
230 // Because we expect to use the effective URL, hosted apps URLs should have 231 // Because we expect to use the effective URL, hosted apps URLs should have
231 // an extension scheme by now. 232 // an extension scheme by now.
232 if (!effective_url.SchemeIs(chrome::kExtensionScheme)) 233 if (!effective_url.SchemeIs(chrome::kExtensionScheme))
233 return false; 234 return false;
234 235
236 Profile* profile = Profile::FromBrowserContext(browser_context);
235 if (!profile || !profile->GetExtensionService()) 237 if (!profile || !profile->GetExtensionService())
236 return false; 238 return false;
237 239
238 const Extension* extension = 240 const Extension* extension =
239 profile->GetExtensionService()->GetExtensionByURL(effective_url); 241 profile->GetExtensionService()->GetExtensionByURL(effective_url);
240 if (!extension) 242 if (!extension)
241 return false; 243 return false;
242 244
243 // If the URL is part of a hosted app that does not have the background 245 // If the URL is part of a hosted app that does not have the background
244 // permission, we want to give each instance its own process to improve 246 // permission, we want to give each instance its own process to improve
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); 295 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
294 #if defined(OS_CHROMEOS) 296 #if defined(OS_CHROMEOS)
295 const std::string& login_profile = 297 const std::string& login_profile =
296 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); 298 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile);
297 if (!login_profile.empty()) 299 if (!login_profile.empty())
298 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); 300 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile);
299 #endif 301 #endif
300 302
301 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); 303 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id);
302 304
303 PrefService* prefs = process->profile()->GetPrefs(); 305 Profile* profile = Profile::FromBrowserContext(process->browser_context());
306 PrefService* prefs = profile->GetPrefs();
304 // Currently this pref is only registered if applied via a policy. 307 // Currently this pref is only registered if applied via a policy.
305 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && 308 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) &&
306 prefs->GetBoolean(prefs::kDisable3DAPIs)) { 309 prefs->GetBoolean(prefs::kDisable3DAPIs)) {
307 // Turn this policy into a command line switch. 310 // Turn this policy into a command line switch.
308 command_line->AppendSwitch(switches::kDisable3DAPIs); 311 command_line->AppendSwitch(switches::kDisable3DAPIs);
309 } 312 }
310 313
311 // Disable client-side phishing detection in the renderer if it is disabled 314 // Disable client-side phishing detection in the renderer if it is disabled
312 // in the Profile preferences or the browser process. 315 // in the Profile preferences or the browser process.
313 if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) || 316 if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) ||
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, 389 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
387 arraysize(kSwitchNames)); 390 arraysize(kSwitchNames));
388 } 391 }
389 } 392 }
390 393
391 std::string ChromeContentBrowserClient::GetApplicationLocale() { 394 std::string ChromeContentBrowserClient::GetApplicationLocale() {
392 return g_browser_process->GetApplicationLocale(); 395 return g_browser_process->GetApplicationLocale();
393 } 396 }
394 397
395 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { 398 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
396 return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); 399 Profile* profile = Profile::FromBrowserContext(tab->browser_context());
400 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
397 } 401 }
398 402
399 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { 403 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() {
400 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 404 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
401 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 405 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
402 } 406 }
403 407
404 bool ChromeContentBrowserClient::AllowAppCache( 408 bool ChromeContentBrowserClient::AllowAppCache(
405 const GURL& manifest_url, 409 const GURL& manifest_url,
406 const content::ResourceContext& context) { 410 const content::ResourceContext& context) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 int render_process_id, 569 int render_process_id,
566 int render_view_id) { 570 int render_view_id) {
567 RenderViewHost* rvh = RenderViewHost::FromID( 571 RenderViewHost* rvh = RenderViewHost::FromID(
568 render_process_id, render_view_id); 572 render_process_id, render_view_id);
569 if (!rvh) { 573 if (!rvh) {
570 NOTREACHED(); 574 NOTREACHED();
571 return; 575 return;
572 } 576 }
573 577
574 RenderProcessHost* process = rvh->process(); 578 RenderProcessHost* process = rvh->process();
579 Profile* profile = Profile::FromBrowserContext(process->browser_context());
575 DesktopNotificationService* service = 580 DesktopNotificationService* service =
576 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 581 DesktopNotificationServiceFactory::GetForProfile(profile);
577 service->RequestPermission( 582 service->RequestPermission(
578 source_origin, render_process_id, render_view_id, callback_context, 583 source_origin, render_process_id, render_view_id, callback_context,
579 tab_util::GetTabContentsByID(render_process_id, render_view_id)); 584 tab_util::GetTabContentsByID(render_process_id, render_view_id));
580 } 585 }
581 586
582 WebKit::WebNotificationPresenter::Permission 587 WebKit::WebNotificationPresenter::Permission
583 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 588 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
584 const GURL& source_url, 589 const GURL& source_url,
585 const content::ResourceContext& context) { 590 const content::ResourceContext& context) {
586 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 591 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 20 matching lines...) Expand all
607 int render_view_id, 612 int render_view_id,
608 bool worker) { 613 bool worker) {
609 RenderViewHost* rvh = RenderViewHost::FromID( 614 RenderViewHost* rvh = RenderViewHost::FromID(
610 render_process_id, render_view_id); 615 render_process_id, render_view_id);
611 if (!rvh) { 616 if (!rvh) {
612 NOTREACHED(); 617 NOTREACHED();
613 return; 618 return;
614 } 619 }
615 620
616 RenderProcessHost* process = rvh->process(); 621 RenderProcessHost* process = rvh->process();
622 Profile* profile = Profile::FromBrowserContext(process->browser_context());
617 DesktopNotificationService* service = 623 DesktopNotificationService* service =
618 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 624 DesktopNotificationServiceFactory::GetForProfile(profile);
619 service->ShowDesktopNotification( 625 service->ShowDesktopNotification(
620 params, render_process_id, render_view_id, 626 params, render_process_id, render_view_id,
621 worker ? DesktopNotificationService::WorkerNotification : 627 worker ? DesktopNotificationService::WorkerNotification :
622 DesktopNotificationService::PageNotification); 628 DesktopNotificationService::PageNotification);
623 } 629 }
624 630
625 void ChromeContentBrowserClient::CancelDesktopNotification( 631 void ChromeContentBrowserClient::CancelDesktopNotification(
626 int render_process_id, 632 int render_process_id,
627 int render_view_id, 633 int render_view_id,
628 int notification_id) { 634 int notification_id) {
629 RenderViewHost* rvh = RenderViewHost::FromID( 635 RenderViewHost* rvh = RenderViewHost::FromID(
630 render_process_id, render_view_id); 636 render_process_id, render_view_id);
631 if (!rvh) { 637 if (!rvh) {
632 NOTREACHED(); 638 NOTREACHED();
633 return; 639 return;
634 } 640 }
635 641
636 RenderProcessHost* process = rvh->process(); 642 RenderProcessHost* process = rvh->process();
643 Profile* profile = Profile::FromBrowserContext(process->browser_context());
637 DesktopNotificationService* service = 644 DesktopNotificationService* service =
638 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 645 DesktopNotificationServiceFactory::GetForProfile(profile);
639 service->CancelDesktopNotification( 646 service->CancelDesktopNotification(
640 render_process_id, render_view_id, notification_id); 647 render_process_id, render_view_id, notification_id);
641 } 648 }
642 649
643 bool ChromeContentBrowserClient::CanCreateWindow( 650 bool ChromeContentBrowserClient::CanCreateWindow(
644 const GURL& source_url, 651 const GURL& source_url,
645 WindowContainerType container_type, 652 WindowContainerType container_type,
646 const content::ResourceContext& context) { 653 const content::ResourceContext& context) {
647 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 654 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
648 // If the opener is trying to create a background window but doesn't have 655 // If the opener is trying to create a background window but doesn't have
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 693
687 DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() { 694 DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() {
688 return g_browser_process->devtools_manager(); 695 return g_browser_process->devtools_manager();
689 } 696 }
690 697
691 bool ChromeContentBrowserClient::IsFastShutdownPossible() { 698 bool ChromeContentBrowserClient::IsFastShutdownPossible() {
692 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 699 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
693 return !browser_command_line.HasSwitch(switches::kChromeFrame); 700 return !browser_command_line.HasSwitch(switches::kChromeFrame);
694 } 701 }
695 702
696 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(Profile* profile, 703 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(
697 bool is_web_ui) { 704 content::BrowserContext* browser_context, bool is_web_ui) {
698 return RenderViewHostDelegateHelper::GetWebkitPrefs(profile, is_web_ui); 705 return RenderViewHostDelegateHelper::GetWebkitPrefs(browser_context,
706 is_web_ui);
699 } 707 }
700 708
701 void ChromeContentBrowserClient::UpdateInspectorSetting( 709 void ChromeContentBrowserClient::UpdateInspectorSetting(
702 RenderViewHost* rvh, const std::string& key, const std::string& value) { 710 RenderViewHost* rvh, const std::string& key, const std::string& value) {
703 RenderViewHostDelegateHelper::UpdateInspectorSetting( 711 RenderViewHostDelegateHelper::UpdateInspectorSetting(
704 rvh->process()->profile(), key, value); 712 rvh->process()->browser_context(), key, value);
705 } 713 }
706 714
707 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { 715 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) {
708 RenderViewHostDelegateHelper::ClearInspectorSettings( 716 RenderViewHostDelegateHelper::ClearInspectorSettings(
709 rvh->process()->profile()); 717 rvh->process()->browser_context());
710 } 718 }
711 719
712 void ChromeContentBrowserClient::BrowserURLHandlerCreated( 720 void ChromeContentBrowserClient::BrowserURLHandlerCreated(
713 BrowserURLHandler* handler) { 721 BrowserURLHandler* handler) {
714 // Add the default URL handlers. 722 // Add the default URL handlers.
715 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, 723 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride,
716 BrowserURLHandler::null_handler()); 724 BrowserURLHandler::null_handler());
717 handler->AddHandlerPair(BrowserURLHandler::null_handler(), 725 handler->AddHandlerPair(BrowserURLHandler::null_handler(),
718 &ExtensionWebUI::HandleChromeURLOverrideReverse); 726 &ExtensionWebUI::HandleChromeURLOverrideReverse);
719 727
720 // about: 728 // about:
721 handler->AddHandlerPair(&WillHandleBrowserAboutURL, 729 handler->AddHandlerPair(&WillHandleBrowserAboutURL,
722 BrowserURLHandler::null_handler()); 730 BrowserURLHandler::null_handler());
723 // chrome: & friends. 731 // chrome: & friends.
724 handler->AddHandlerPair(&HandleWebUI, 732 handler->AddHandlerPair(&HandleWebUI,
725 BrowserURLHandler::null_handler()); 733 BrowserURLHandler::null_handler());
726 } 734 }
727 735
728 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { 736 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) {
729 Profile* profile = rvh->site_instance()->GetProcess()->profile(); 737 Profile* profile = Profile::FromBrowserContext(
738 rvh->site_instance()->GetProcess()->browser_context());
730 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, 739 BrowsingDataRemover* remover = new BrowsingDataRemover(profile,
731 BrowsingDataRemover::EVERYTHING, 740 BrowsingDataRemover::EVERYTHING,
732 base::Time()); 741 base::Time());
733 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); 742 remover->Remove(BrowsingDataRemover::REMOVE_CACHE);
734 // BrowsingDataRemover takes care of deleting itself when done. 743 // BrowsingDataRemover takes care of deleting itself when done.
735 } 744 }
736 745
737 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { 746 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) {
738 Profile* profile = rvh->site_instance()->GetProcess()->profile(); 747 Profile* profile = Profile::FromBrowserContext(
748 rvh->site_instance()->GetProcess()->browser_context());
739 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, 749 BrowsingDataRemover* remover = new BrowsingDataRemover(profile,
740 BrowsingDataRemover::EVERYTHING, 750 BrowsingDataRemover::EVERYTHING,
741 base::Time()); 751 base::Time());
742 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES; 752 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES;
743 remover->Remove(remove_mask); 753 remover->Remove(remove_mask);
744 // BrowsingDataRemover takes care of deleting itself when done. 754 // BrowsingDataRemover takes care of deleting itself when done.
745 } 755 }
746 756
747 void ChromeContentBrowserClient::ChooseSavePath( 757 void ChromeContentBrowserClient::ChooseSavePath(
748 const base::WeakPtr<SavePackage>& save_package, 758 const base::WeakPtr<SavePackage>& save_package,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 #if defined(USE_NSS) 791 #if defined(USE_NSS)
782 crypto::CryptoModuleBlockingPasswordDelegate* 792 crypto::CryptoModuleBlockingPasswordDelegate*
783 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 793 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
784 const GURL& url) { 794 const GURL& url) {
785 return browser::NewCryptoModuleBlockingDialogDelegate( 795 return browser::NewCryptoModuleBlockingDialogDelegate(
786 browser::kCryptoModulePasswordKeygen, url.host()); 796 browser::kCryptoModulePasswordKeygen, url.host());
787 } 797 }
788 #endif 798 #endif
789 799
790 } // namespace chrome 800 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698