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

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: browser_context Created 9 years, 5 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 =
94 static_cast<Profile*>(site_instance->browsing_instance()->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 = static_cast<Profile*>(host->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 = static_cast<Profile*>(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 = static_cast<Profile*>(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 = static_cast<Profile*>(process->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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, 390 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
388 arraysize(kSwitchNames)); 391 arraysize(kSwitchNames));
389 } 392 }
390 } 393 }
391 394
392 std::string ChromeContentBrowserClient::GetApplicationLocale() { 395 std::string ChromeContentBrowserClient::GetApplicationLocale() {
393 return g_browser_process->GetApplicationLocale(); 396 return g_browser_process->GetApplicationLocale();
394 } 397 }
395 398
396 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { 399 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
397 return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); 400 Profile* profile = static_cast<Profile*>(tab->browser_context());
401 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
398 } 402 }
399 403
400 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { 404 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() {
401 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 405 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
402 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 406 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
403 } 407 }
404 408
405 bool ChromeContentBrowserClient::AllowAppCache( 409 bool ChromeContentBrowserClient::AllowAppCache(
406 const GURL& manifest_url, 410 const GURL& manifest_url,
407 const content::ResourceContext& context) { 411 const content::ResourceContext& context) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 int render_process_id, 570 int render_process_id,
567 int render_view_id) { 571 int render_view_id) {
568 RenderViewHost* rvh = RenderViewHost::FromID( 572 RenderViewHost* rvh = RenderViewHost::FromID(
569 render_process_id, render_view_id); 573 render_process_id, render_view_id);
570 if (!rvh) { 574 if (!rvh) {
571 NOTREACHED(); 575 NOTREACHED();
572 return; 576 return;
573 } 577 }
574 578
575 RenderProcessHost* process = rvh->process(); 579 RenderProcessHost* process = rvh->process();
580 Profile* profile = static_cast<Profile*>(process->context());
576 DesktopNotificationService* service = 581 DesktopNotificationService* service =
577 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 582 DesktopNotificationServiceFactory::GetForProfile(profile);
578 service->RequestPermission( 583 service->RequestPermission(
579 source_origin, render_process_id, render_view_id, callback_context, 584 source_origin, render_process_id, render_view_id, callback_context,
580 tab_util::GetTabContentsByID(render_process_id, render_view_id)); 585 tab_util::GetTabContentsByID(render_process_id, render_view_id));
581 } 586 }
582 587
583 WebKit::WebNotificationPresenter::Permission 588 WebKit::WebNotificationPresenter::Permission
584 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 589 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
585 const GURL& source_url, 590 const GURL& source_url,
586 const content::ResourceContext& context) { 591 const content::ResourceContext& context) {
587 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 592 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 20 matching lines...) Expand all
608 int render_view_id, 613 int render_view_id,
609 bool worker) { 614 bool worker) {
610 RenderViewHost* rvh = RenderViewHost::FromID( 615 RenderViewHost* rvh = RenderViewHost::FromID(
611 render_process_id, render_view_id); 616 render_process_id, render_view_id);
612 if (!rvh) { 617 if (!rvh) {
613 NOTREACHED(); 618 NOTREACHED();
614 return; 619 return;
615 } 620 }
616 621
617 RenderProcessHost* process = rvh->process(); 622 RenderProcessHost* process = rvh->process();
623 Profile* profile = static_cast<Profile*>(process->context());
618 DesktopNotificationService* service = 624 DesktopNotificationService* service =
619 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 625 DesktopNotificationServiceFactory::GetForProfile(profile);
620 service->ShowDesktopNotification( 626 service->ShowDesktopNotification(
621 params, render_process_id, render_view_id, 627 params, render_process_id, render_view_id,
622 worker ? DesktopNotificationService::WorkerNotification : 628 worker ? DesktopNotificationService::WorkerNotification :
623 DesktopNotificationService::PageNotification); 629 DesktopNotificationService::PageNotification);
624 } 630 }
625 631
626 void ChromeContentBrowserClient::CancelDesktopNotification( 632 void ChromeContentBrowserClient::CancelDesktopNotification(
627 int render_process_id, 633 int render_process_id,
628 int render_view_id, 634 int render_view_id,
629 int notification_id) { 635 int notification_id) {
630 RenderViewHost* rvh = RenderViewHost::FromID( 636 RenderViewHost* rvh = RenderViewHost::FromID(
631 render_process_id, render_view_id); 637 render_process_id, render_view_id);
632 if (!rvh) { 638 if (!rvh) {
633 NOTREACHED(); 639 NOTREACHED();
634 return; 640 return;
635 } 641 }
636 642
637 RenderProcessHost* process = rvh->process(); 643 RenderProcessHost* process = rvh->process();
644 Profile* profile = static_cast<Profile*>(process->context());
638 DesktopNotificationService* service = 645 DesktopNotificationService* service =
639 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 646 DesktopNotificationServiceFactory::GetForProfile(profile);
640 service->CancelDesktopNotification( 647 service->CancelDesktopNotification(
641 render_process_id, render_view_id, notification_id); 648 render_process_id, render_view_id, notification_id);
642 } 649 }
643 650
644 bool ChromeContentBrowserClient::CanCreateWindow( 651 bool ChromeContentBrowserClient::CanCreateWindow(
645 const GURL& source_url, 652 const GURL& source_url,
646 WindowContainerType container_type, 653 WindowContainerType container_type,
647 const content::ResourceContext& context) { 654 const content::ResourceContext& context) {
648 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 655 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
649 // If the opener is trying to create a background window but doesn't have 656 // 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
687 694
688 DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() { 695 DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() {
689 return g_browser_process->devtools_manager(); 696 return g_browser_process->devtools_manager();
690 } 697 }
691 698
692 bool ChromeContentBrowserClient::IsFastShutdownPossible() { 699 bool ChromeContentBrowserClient::IsFastShutdownPossible() {
693 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 700 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
694 return !browser_command_line.HasSwitch(switches::kChromeFrame); 701 return !browser_command_line.HasSwitch(switches::kChromeFrame);
695 } 702 }
696 703
697 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(Profile* profile, 704 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(
698 bool is_web_ui) { 705 content::BrowserContext* browser_context, bool is_web_ui) {
699 return RenderViewHostDelegateHelper::GetWebkitPrefs(profile, is_web_ui); 706 return RenderViewHostDelegateHelper::GetWebkitPrefs(browser_context,
707 is_web_ui);
700 } 708 }
701 709
702 void ChromeContentBrowserClient::UpdateInspectorSetting( 710 void ChromeContentBrowserClient::UpdateInspectorSetting(
703 RenderViewHost* rvh, const std::string& key, const std::string& value) { 711 RenderViewHost* rvh, const std::string& key, const std::string& value) {
704 RenderViewHostDelegateHelper::UpdateInspectorSetting( 712 RenderViewHostDelegateHelper::UpdateInspectorSetting(
705 rvh->process()->profile(), key, value); 713 rvh->process()->context(), key, value);
706 } 714 }
707 715
708 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { 716 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) {
709 RenderViewHostDelegateHelper::ClearInspectorSettings( 717 RenderViewHostDelegateHelper::ClearInspectorSettings(
710 rvh->process()->profile()); 718 rvh->process()->context());
711 } 719 }
712 720
713 void ChromeContentBrowserClient::BrowserURLHandlerCreated( 721 void ChromeContentBrowserClient::BrowserURLHandlerCreated(
714 BrowserURLHandler* handler) { 722 BrowserURLHandler* handler) {
715 // Add the default URL handlers. 723 // Add the default URL handlers.
716 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, 724 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride,
717 BrowserURLHandler::null_handler()); 725 BrowserURLHandler::null_handler());
718 handler->AddHandlerPair(BrowserURLHandler::null_handler(), 726 handler->AddHandlerPair(BrowserURLHandler::null_handler(),
719 &ExtensionWebUI::HandleChromeURLOverrideReverse); 727 &ExtensionWebUI::HandleChromeURLOverrideReverse);
720 728
721 // about: 729 // about:
722 handler->AddHandlerPair(&WillHandleBrowserAboutURL, 730 handler->AddHandlerPair(&WillHandleBrowserAboutURL,
723 BrowserURLHandler::null_handler()); 731 BrowserURLHandler::null_handler());
724 // chrome: & friends. 732 // chrome: & friends.
725 handler->AddHandlerPair(&HandleWebUI, 733 handler->AddHandlerPair(&HandleWebUI,
726 BrowserURLHandler::null_handler()); 734 BrowserURLHandler::null_handler());
727 } 735 }
728 736
729 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { 737 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) {
730 Profile* profile = rvh->site_instance()->GetProcess()->profile(); 738 Profile* profile =
739 static_cast<Profile*>(rvh->site_instance()->GetProcess()->context());
731 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, 740 BrowsingDataRemover* remover = new BrowsingDataRemover(profile,
732 BrowsingDataRemover::EVERYTHING, 741 BrowsingDataRemover::EVERYTHING,
733 base::Time()); 742 base::Time());
734 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); 743 remover->Remove(BrowsingDataRemover::REMOVE_CACHE);
735 // BrowsingDataRemover takes care of deleting itself when done. 744 // BrowsingDataRemover takes care of deleting itself when done.
736 } 745 }
737 746
738 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { 747 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) {
739 Profile* profile = rvh->site_instance()->GetProcess()->profile(); 748 Profile* profile =
749 static_cast<Profile*>(rvh->site_instance()->GetProcess()->context());
740 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, 750 BrowsingDataRemover* remover = new BrowsingDataRemover(profile,
741 BrowsingDataRemover::EVERYTHING, 751 BrowsingDataRemover::EVERYTHING,
742 base::Time()); 752 base::Time());
743 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES; 753 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES;
744 remover->Remove(remove_mask); 754 remover->Remove(remove_mask);
745 // BrowsingDataRemover takes care of deleting itself when done. 755 // BrowsingDataRemover takes care of deleting itself when done.
746 } 756 }
747 757
748 void ChromeContentBrowserClient::ChooseSavePath( 758 void ChromeContentBrowserClient::ChooseSavePath(
749 const base::WeakPtr<SavePackage>& save_package, 759 const base::WeakPtr<SavePackage>& save_package,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 #if defined(USE_NSS) 792 #if defined(USE_NSS)
783 crypto::CryptoModuleBlockingPasswordDelegate* 793 crypto::CryptoModuleBlockingPasswordDelegate*
784 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 794 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
785 const GURL& url) { 795 const GURL& url) {
786 return browser::NewCryptoModuleBlockingDialogDelegate( 796 return browser::NewCryptoModuleBlockingDialogDelegate(
787 browser::kCryptoModulePasswordKeygen, url.host()); 797 browser::kCryptoModulePasswordKeygen, url.host());
788 } 798 }
789 #endif 799 #endif
790 800
791 } // namespace chrome 801 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698