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

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: works now 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { 81 void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) {
82 // Note that due to GetEffectiveURL(), even hosted apps will have a 82 // Note that due to GetEffectiveURL(), even hosted apps will have a
83 // chrome-extension:// URL for their site, so we can ignore that wrinkle here. 83 // chrome-extension:// URL for their site, so we can ignore that wrinkle here.
84 SiteInstance* site_instance = render_view_host->site_instance(); 84 SiteInstance* site_instance = render_view_host->site_instance();
85 const GURL& site = site_instance->site(); 85 const GURL& site = site_instance->site();
86 RenderProcessHost* process = render_view_host->process(); 86 RenderProcessHost* process = render_view_host->process();
87 87
88 if (!site.SchemeIs(chrome::kExtensionScheme)) 88 if (!site.SchemeIs(chrome::kExtensionScheme))
89 return; 89 return;
90 90
91 Profile* profile = site_instance->browsing_instance()->profile(); 91 Profile* profile =
92 static_cast<Profile*>(site_instance->browsing_instance()->context());
92 ExtensionService* service = profile->GetExtensionService(); 93 ExtensionService* service = profile->GetExtensionService();
93 if (!service) 94 if (!service)
94 return; 95 return;
95 96
96 ExtensionProcessManager* process_manager = 97 ExtensionProcessManager* process_manager =
97 profile->GetExtensionProcessManager(); 98 profile->GetExtensionProcessManager();
98 CHECK(process_manager); 99 CHECK(process_manager);
99 100
100 // This can happen if somebody typos a chrome-extension:// URL. 101 // This can happen if somebody typos a chrome-extension:// URL.
101 const Extension* extension = service->GetExtensionByURL(site); 102 const Extension* extension = service->GetExtensionByURL(site);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 type == Extension::TYPE_USER_SCRIPT || 134 type == Extension::TYPE_USER_SCRIPT ||
134 type == Extension::TYPE_PACKAGED_APP || 135 type == Extension::TYPE_PACKAGED_APP ||
135 (type == Extension::TYPE_HOSTED_APP && 136 (type == Extension::TYPE_HOSTED_APP &&
136 extension->location() == Extension::COMPONENT)) { 137 extension->location() == Extension::COMPONENT)) {
137 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); 138 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id()));
138 render_view_host->AllowBindings(BindingsPolicy::EXTENSION); 139 render_view_host->AllowBindings(BindingsPolicy::EXTENSION);
139 } 140 }
140 } 141 }
141 142
142 // Handles rewriting Web UI URLs. 143 // Handles rewriting Web UI URLs.
143 static bool HandleWebUI(GURL* url, Profile* profile) { 144 static bool HandleWebUI(GURL* url, content::BrowserContext* context) {
144 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(profile, *url)) 145 if (!ChromeWebUIFactory::GetInstance()->UseWebUIForURL(context, *url))
145 return false; 146 return false;
146 147
147 // Special case the new tab page. In older versions of Chrome, the new tab 148 // Special case the new tab page. In older versions of Chrome, the new tab
148 // page was hosted at chrome-internal:<blah>. This might be in people's saved 149 // page was hosted at chrome-internal:<blah>. This might be in people's saved
149 // sessions or bookmarks, so we say any URL with that scheme triggers the new 150 // sessions or bookmarks, so we say any URL with that scheme triggers the new
150 // tab page. 151 // tab page.
151 if (url->SchemeIs(chrome::kChromeInternalScheme)) { 152 if (url->SchemeIs(chrome::kChromeInternalScheme)) {
152 // Rewrite it with the proper new tab URL. 153 // Rewrite it with the proper new tab URL.
153 *url = GURL(chrome::kChromeUINewTabURL); 154 *url = GURL(chrome::kChromeUINewTabURL);
154 } 155 }
(...skipping 10 matching lines...) Expand all
165 new ChromeRenderViewHostObserver(render_view_host); 166 new ChromeRenderViewHostObserver(render_view_host);
166 new DevToolsHandler(render_view_host); 167 new DevToolsHandler(render_view_host);
167 new ExtensionMessageHandler(render_view_host); 168 new ExtensionMessageHandler(render_view_host);
168 169
169 InitRenderViewHostForExtensions(render_view_host); 170 InitRenderViewHostForExtensions(render_view_host);
170 } 171 }
171 172
172 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( 173 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated(
173 BrowserRenderProcessHost* host) { 174 BrowserRenderProcessHost* host) {
174 int id = host->id(); 175 int id = host->id();
175 Profile* profile = host->profile(); 176 Profile* profile = static_cast<Profile*>(host->context());
176 host->channel()->AddFilter(new ChromeRenderMessageFilter( 177 host->channel()->AddFilter(new ChromeRenderMessageFilter(
177 id, profile, profile->GetRequestContextForRenderProcess(id))); 178 id, profile, profile->GetRequestContextForRenderProcess(id)));
178 host->channel()->AddFilter(new PrintingMessageFilter()); 179 host->channel()->AddFilter(new PrintingMessageFilter());
179 host->channel()->AddFilter( 180 host->channel()->AddFilter(
180 new SearchProviderInstallStateMessageFilter(id, profile)); 181 new SearchProviderInstallStateMessageFilter(id, profile));
181 host->channel()->AddFilter(new SpellCheckMessageFilter(id)); 182 host->channel()->AddFilter(new SpellCheckMessageFilter(id));
182 #if defined(OS_MACOSX) 183 #if defined(OS_MACOSX)
183 host->channel()->AddFilter(new TextInputClientMessageFilter(host->id())); 184 host->channel()->AddFilter(new TextInputClientMessageFilter(host->id()));
184 #endif 185 #endif
185 186
186 host->Send(new ViewMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); 187 host->Send(new ViewMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
187 } 188 }
188 189
189 void ChromeContentBrowserClient::PluginProcessHostCreated( 190 void ChromeContentBrowserClient::PluginProcessHostCreated(
190 PluginProcessHost* host) { 191 PluginProcessHost* host) {
191 host->AddFilter(new ChromePluginMessageFilter(host)); 192 host->AddFilter(new ChromePluginMessageFilter(host));
192 } 193 }
193 194
194 void ChromeContentBrowserClient::WorkerProcessHostCreated( 195 void ChromeContentBrowserClient::WorkerProcessHostCreated(
195 WorkerProcessHost* host) { 196 WorkerProcessHost* host) {
196 host->AddFilter(new ChromeWorkerMessageFilter(host)); 197 host->AddFilter(new ChromeWorkerMessageFilter(host));
197 } 198 }
198 199
199 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() { 200 content::WebUIFactory* ChromeContentBrowserClient::GetWebUIFactory() {
200 return ChromeWebUIFactory::GetInstance(); 201 return ChromeWebUIFactory::GetInstance();
201 } 202 }
202 203
203 GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile, 204 GURL ChromeContentBrowserClient::GetEffectiveURL(
204 const GURL& url) { 205 content::BrowserContext* context, const GURL& url) {
206 Profile* profile = static_cast<Profile*>(context);
205 // Get the effective URL for the given actual URL. If the URL is part of an 207 // Get the effective URL for the given actual URL. If the URL is part of an
206 // installed app, the effective URL is an extension URL with the ID of that 208 // installed app, the effective URL is an extension URL with the ID of that
207 // extension as the host. This has the effect of grouping apps together in 209 // extension as the host. This has the effect of grouping apps together in
208 // a common SiteInstance. 210 // a common SiteInstance.
209 if (!profile || !profile->GetExtensionService()) 211 if (!profile || !profile->GetExtensionService())
210 return url; 212 return url;
211 213
212 const Extension* extension = 214 const Extension* extension =
213 profile->GetExtensionService()->GetExtensionByWebExtent(url); 215 profile->GetExtensionService()->GetExtensionByWebExtent(url);
214 if (!extension) 216 if (!extension)
215 return url; 217 return url;
216 218
217 // If the URL is part of an extension's web extent, convert it to an 219 // If the URL is part of an extension's web extent, convert it to an
218 // extension URL. 220 // extension URL.
219 return extension->GetResourceURL(url.path()); 221 return extension->GetResourceURL(url.path());
220 } 222 }
221 223
222 bool ChromeContentBrowserClient::ShouldUseProcessPerSite( 224 bool ChromeContentBrowserClient::ShouldUseProcessPerSite(
223 Profile* profile, 225 content::BrowserContext* context, const GURL& effective_url) {
224 const GURL& effective_url) {
225 // Non-extension URLs should generally use process-per-site-instance. 226 // Non-extension URLs should generally use process-per-site-instance.
226 // Because we expect to use the effective URL, hosted apps URLs should have 227 // Because we expect to use the effective URL, hosted apps URLs should have
227 // an extension scheme by now. 228 // an extension scheme by now.
228 if (!effective_url.SchemeIs(chrome::kExtensionScheme)) 229 if (!effective_url.SchemeIs(chrome::kExtensionScheme))
229 return false; 230 return false;
230 231
232 Profile* profile = static_cast<Profile*>(context);
231 if (!profile || !profile->GetExtensionService()) 233 if (!profile || !profile->GetExtensionService())
232 return false; 234 return false;
233 235
234 const Extension* extension = 236 const Extension* extension =
235 profile->GetExtensionService()->GetExtensionByURL(effective_url); 237 profile->GetExtensionService()->GetExtensionByURL(effective_url);
236 if (!extension) 238 if (!extension)
237 return false; 239 return false;
238 240
239 // If the URL is part of a hosted app that does not have the background 241 // If the URL is part of a hosted app that does not have the background
240 // permission, we want to give each instance its own process to improve 242 // permission, we want to give each instance its own process to improve
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); 291 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
290 #if defined(OS_CHROMEOS) 292 #if defined(OS_CHROMEOS)
291 const std::string& login_profile = 293 const std::string& login_profile =
292 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); 294 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile);
293 if (!login_profile.empty()) 295 if (!login_profile.empty())
294 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); 296 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile);
295 #endif 297 #endif
296 298
297 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); 299 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id);
298 300
299 PrefService* prefs = process->profile()->GetPrefs(); 301 Profile* profile = static_cast<Profile*>(process->context());
302 PrefService* prefs = profile->GetPrefs();
300 // Currently this pref is only registered if applied via a policy. 303 // Currently this pref is only registered if applied via a policy.
301 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && 304 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) &&
302 prefs->GetBoolean(prefs::kDisable3DAPIs)) { 305 prefs->GetBoolean(prefs::kDisable3DAPIs)) {
303 // Turn this policy into a command line switch. 306 // Turn this policy into a command line switch.
304 command_line->AppendSwitch(switches::kDisable3DAPIs); 307 command_line->AppendSwitch(switches::kDisable3DAPIs);
305 } 308 }
306 309
307 // Disable client-side phishing detection in the renderer if it is disabled 310 // Disable client-side phishing detection in the renderer if it is disabled
308 // in the Profile preferences or the browser process. 311 // in the Profile preferences or the browser process.
309 if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) || 312 if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) ||
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames, 386 command_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
384 arraysize(kSwitchNames)); 387 arraysize(kSwitchNames));
385 } 388 }
386 } 389 }
387 390
388 std::string ChromeContentBrowserClient::GetApplicationLocale() { 391 std::string ChromeContentBrowserClient::GetApplicationLocale() {
389 return g_browser_process->GetApplicationLocale(); 392 return g_browser_process->GetApplicationLocale();
390 } 393 }
391 394
392 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) { 395 std::string ChromeContentBrowserClient::GetAcceptLangs(const TabContents* tab) {
393 return tab->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); 396 Profile* profile = static_cast<Profile*>(tab->context());
397 return profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
394 } 398 }
395 399
396 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() { 400 SkBitmap* ChromeContentBrowserClient::GetDefaultFavicon() {
397 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 401 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
398 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 402 return rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
399 } 403 }
400 404
401 bool ChromeContentBrowserClient::AllowAppCache( 405 bool ChromeContentBrowserClient::AllowAppCache(
402 const GURL& manifest_url, 406 const GURL& manifest_url,
403 const content::ResourceContext& context) { 407 const content::ResourceContext& context) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 int render_process_id, 545 int render_process_id,
542 int render_view_id) { 546 int render_view_id) {
543 RenderViewHost* rvh = RenderViewHost::FromID( 547 RenderViewHost* rvh = RenderViewHost::FromID(
544 render_process_id, render_view_id); 548 render_process_id, render_view_id);
545 if (!rvh) { 549 if (!rvh) {
546 NOTREACHED(); 550 NOTREACHED();
547 return; 551 return;
548 } 552 }
549 553
550 RenderProcessHost* process = rvh->process(); 554 RenderProcessHost* process = rvh->process();
555 Profile* profile = static_cast<Profile*>(process->context());
551 DesktopNotificationService* service = 556 DesktopNotificationService* service =
552 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 557 DesktopNotificationServiceFactory::GetForProfile(profile);
553 service->RequestPermission( 558 service->RequestPermission(
554 source_origin, render_process_id, render_view_id, callback_context, 559 source_origin, render_process_id, render_view_id, callback_context,
555 tab_util::GetTabContentsByID(render_process_id, render_view_id)); 560 tab_util::GetTabContentsByID(render_process_id, render_view_id));
556 } 561 }
557 562
558 WebKit::WebNotificationPresenter::Permission 563 WebKit::WebNotificationPresenter::Permission
559 ChromeContentBrowserClient::CheckDesktopNotificationPermission( 564 ChromeContentBrowserClient::CheckDesktopNotificationPermission(
560 const GURL& source_url, 565 const GURL& source_url,
561 const content::ResourceContext& context) { 566 const content::ResourceContext& context) {
562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 20 matching lines...) Expand all
583 int render_view_id, 588 int render_view_id,
584 bool worker) { 589 bool worker) {
585 RenderViewHost* rvh = RenderViewHost::FromID( 590 RenderViewHost* rvh = RenderViewHost::FromID(
586 render_process_id, render_view_id); 591 render_process_id, render_view_id);
587 if (!rvh) { 592 if (!rvh) {
588 NOTREACHED(); 593 NOTREACHED();
589 return; 594 return;
590 } 595 }
591 596
592 RenderProcessHost* process = rvh->process(); 597 RenderProcessHost* process = rvh->process();
598 Profile* profile = static_cast<Profile*>(process->context());
593 DesktopNotificationService* service = 599 DesktopNotificationService* service =
594 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 600 DesktopNotificationServiceFactory::GetForProfile(profile);
595 service->ShowDesktopNotification( 601 service->ShowDesktopNotification(
596 params, render_process_id, render_view_id, 602 params, render_process_id, render_view_id,
597 worker ? DesktopNotificationService::WorkerNotification : 603 worker ? DesktopNotificationService::WorkerNotification :
598 DesktopNotificationService::PageNotification); 604 DesktopNotificationService::PageNotification);
599 } 605 }
600 606
601 void ChromeContentBrowserClient::CancelDesktopNotification( 607 void ChromeContentBrowserClient::CancelDesktopNotification(
602 int render_process_id, 608 int render_process_id,
603 int render_view_id, 609 int render_view_id,
604 int notification_id) { 610 int notification_id) {
605 RenderViewHost* rvh = RenderViewHost::FromID( 611 RenderViewHost* rvh = RenderViewHost::FromID(
606 render_process_id, render_view_id); 612 render_process_id, render_view_id);
607 if (!rvh) { 613 if (!rvh) {
608 NOTREACHED(); 614 NOTREACHED();
609 return; 615 return;
610 } 616 }
611 617
612 RenderProcessHost* process = rvh->process(); 618 RenderProcessHost* process = rvh->process();
619 Profile* profile = static_cast<Profile*>(process->context());
613 DesktopNotificationService* service = 620 DesktopNotificationService* service =
614 DesktopNotificationServiceFactory::GetForProfile(process->profile()); 621 DesktopNotificationServiceFactory::GetForProfile(profile);
615 service->CancelDesktopNotification( 622 service->CancelDesktopNotification(
616 render_process_id, render_view_id, notification_id); 623 render_process_id, render_view_id, notification_id);
617 } 624 }
618 625
619 bool ChromeContentBrowserClient::CanCreateWindow( 626 bool ChromeContentBrowserClient::CanCreateWindow(
620 const GURL& source_url, 627 const GURL& source_url,
621 WindowContainerType container_type, 628 WindowContainerType container_type,
622 const content::ResourceContext& context) { 629 const content::ResourceContext& context) {
623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
624 // If the opener is trying to create a background window but doesn't have 631 // 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
662 669
663 DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() { 670 DevToolsManager* ChromeContentBrowserClient::GetDevToolsManager() {
664 return g_browser_process->devtools_manager(); 671 return g_browser_process->devtools_manager();
665 } 672 }
666 673
667 bool ChromeContentBrowserClient::IsFastShutdownPossible() { 674 bool ChromeContentBrowserClient::IsFastShutdownPossible() {
668 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 675 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
669 return !browser_command_line.HasSwitch(switches::kChromeFrame); 676 return !browser_command_line.HasSwitch(switches::kChromeFrame);
670 } 677 }
671 678
672 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(Profile* profile, 679 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(
673 bool is_web_ui) { 680 content::BrowserContext* context, bool is_web_ui) {
674 return RenderViewHostDelegateHelper::GetWebkitPrefs(profile, is_web_ui); 681 return RenderViewHostDelegateHelper::GetWebkitPrefs(context, is_web_ui);
675 } 682 }
676 683
677 void ChromeContentBrowserClient::UpdateInspectorSetting( 684 void ChromeContentBrowserClient::UpdateInspectorSetting(
678 RenderViewHost* rvh, const std::string& key, const std::string& value) { 685 RenderViewHost* rvh, const std::string& key, const std::string& value) {
679 RenderViewHostDelegateHelper::UpdateInspectorSetting( 686 RenderViewHostDelegateHelper::UpdateInspectorSetting(
680 rvh->process()->profile(), key, value); 687 rvh->process()->context(), key, value);
681 } 688 }
682 689
683 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { 690 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) {
684 RenderViewHostDelegateHelper::ClearInspectorSettings( 691 RenderViewHostDelegateHelper::ClearInspectorSettings(
685 rvh->process()->profile()); 692 rvh->process()->context());
686 } 693 }
687 694
688 void ChromeContentBrowserClient::BrowserURLHandlerCreated( 695 void ChromeContentBrowserClient::BrowserURLHandlerCreated(
689 BrowserURLHandler* handler) { 696 BrowserURLHandler* handler) {
690 // Add the default URL handlers. 697 // Add the default URL handlers.
691 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, 698 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride,
692 BrowserURLHandler::null_handler()); 699 BrowserURLHandler::null_handler());
693 handler->AddHandlerPair(BrowserURLHandler::null_handler(), 700 handler->AddHandlerPair(BrowserURLHandler::null_handler(),
694 &ExtensionWebUI::HandleChromeURLOverrideReverse); 701 &ExtensionWebUI::HandleChromeURLOverrideReverse);
695 702
696 // about: 703 // about:
697 handler->AddHandlerPair(&WillHandleBrowserAboutURL, 704 handler->AddHandlerPair(&WillHandleBrowserAboutURL,
698 BrowserURLHandler::null_handler()); 705 BrowserURLHandler::null_handler());
699 // chrome: & friends. 706 // chrome: & friends.
700 handler->AddHandlerPair(&HandleWebUI, 707 handler->AddHandlerPair(&HandleWebUI,
701 BrowserURLHandler::null_handler()); 708 BrowserURLHandler::null_handler());
702 } 709 }
703 710
704 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { 711 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) {
705 Profile* profile = rvh->site_instance()->GetProcess()->profile(); 712 Profile* profile =
713 static_cast<Profile*>(rvh->site_instance()->GetProcess()->context());
706 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, 714 BrowsingDataRemover* remover = new BrowsingDataRemover(profile,
707 BrowsingDataRemover::EVERYTHING, 715 BrowsingDataRemover::EVERYTHING,
708 base::Time()); 716 base::Time());
709 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); 717 remover->Remove(BrowsingDataRemover::REMOVE_CACHE);
710 // BrowsingDataRemover takes care of deleting itself when done. 718 // BrowsingDataRemover takes care of deleting itself when done.
711 } 719 }
712 720
713 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { 721 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) {
714 Profile* profile = rvh->site_instance()->GetProcess()->profile(); 722 Profile* profile =
723 static_cast<Profile*>(rvh->site_instance()->GetProcess()->context());
715 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, 724 BrowsingDataRemover* remover = new BrowsingDataRemover(profile,
716 BrowsingDataRemover::EVERYTHING, 725 BrowsingDataRemover::EVERYTHING,
717 base::Time()); 726 base::Time());
718 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES; 727 int remove_mask = BrowsingDataRemover::REMOVE_COOKIES;
719 remover->Remove(remove_mask); 728 remover->Remove(remove_mask);
720 // BrowsingDataRemover takes care of deleting itself when done. 729 // BrowsingDataRemover takes care of deleting itself when done.
721 } 730 }
722 731
723 void ChromeContentBrowserClient::ChooseSavePath( 732 void ChromeContentBrowserClient::ChooseSavePath(
724 const base::WeakPtr<SavePackage>& save_package, 733 const base::WeakPtr<SavePackage>& save_package,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 #if defined(USE_NSS) 766 #if defined(USE_NSS)
758 crypto::CryptoModuleBlockingPasswordDelegate* 767 crypto::CryptoModuleBlockingPasswordDelegate*
759 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 768 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
760 const GURL& url) { 769 const GURL& url) {
761 return browser::NewCryptoModuleBlockingDialogDelegate( 770 return browser::NewCryptoModuleBlockingDialogDelegate(
762 browser::kCryptoModulePasswordKeygen, url.host()); 771 browser::kCryptoModulePasswordKeygen, url.host());
763 } 772 }
764 #endif 773 #endif
765 774
766 } // namespace chrome 775 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698