| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "chrome/common/chrome_constants.h" | 56 #include "chrome/common/chrome_constants.h" |
| 57 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/extensions/extension.h" | 58 #include "chrome/common/extensions/extension.h" |
| 59 #include "chrome/common/logging_chrome.h" | 59 #include "chrome/common/logging_chrome.h" |
| 60 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
| 61 #include "chrome/common/render_messages.h" | 61 #include "chrome/common/render_messages.h" |
| 62 #include "chrome/common/url_constants.h" | 62 #include "chrome/common/url_constants.h" |
| 63 #include "content/browser/browser_url_handler.h" | 63 #include "content/browser/browser_url_handler.h" |
| 64 #include "content/browser/browsing_instance.h" | 64 #include "content/browser/browsing_instance.h" |
| 65 #include "content/browser/plugin_process_host.h" | 65 #include "content/browser/plugin_process_host.h" |
| 66 #include "content/browser/renderer_host/browser_render_process_host.h" | |
| 67 #include "content/browser/renderer_host/render_view_host.h" | 66 #include "content/browser/renderer_host/render_view_host.h" |
| 68 #include "content/browser/resource_context.h" | 67 #include "content/browser/resource_context.h" |
| 69 #include "content/browser/site_instance.h" | 68 #include "content/browser/site_instance.h" |
| 70 #include "content/browser/ssl/ssl_cert_error_handler.h" | 69 #include "content/browser/ssl/ssl_cert_error_handler.h" |
| 71 #include "content/browser/ssl/ssl_client_auth_handler.h" | 70 #include "content/browser/ssl/ssl_client_auth_handler.h" |
| 72 #include "content/browser/tab_contents/tab_contents.h" | 71 #include "content/browser/tab_contents/tab_contents.h" |
| 73 #include "content/browser/tab_contents/tab_contents_view.h" | 72 #include "content/browser/tab_contents/tab_contents_view.h" |
| 74 #include "content/browser/worker_host/worker_process_host.h" | 73 #include "content/browser/worker_host/worker_process_host.h" |
| 75 #include "content/public/browser/browser_main_parts.h" | 74 #include "content/public/browser/browser_main_parts.h" |
| 75 #include "content/public/browser/render_process_host.h" |
| 76 #include "grit/generated_resources.h" | 76 #include "grit/generated_resources.h" |
| 77 #include "grit/ui_resources.h" | 77 #include "grit/ui_resources.h" |
| 78 #include "net/base/cookie_monster.h" | 78 #include "net/base/cookie_monster.h" |
| 79 #include "net/base/cookie_options.h" | 79 #include "net/base/cookie_options.h" |
| 80 #include "ui/base/l10n/l10n_util.h" | 80 #include "ui/base/l10n/l10n_util.h" |
| 81 #include "ui/base/resource/resource_bundle.h" | 81 #include "ui/base/resource/resource_bundle.h" |
| 82 | 82 |
| 83 #if defined(OS_WIN) | 83 #if defined(OS_WIN) |
| 84 #include "chrome/browser/chrome_browser_main_win.h" | 84 #include "chrome/browser/chrome_browser_main_win.h" |
| 85 #elif defined(OS_MACOSX) | 85 #elif defined(OS_MACOSX) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return PRIV_NORMAL; | 194 return PRIV_NORMAL; |
| 195 } | 195 } |
| 196 | 196 |
| 197 RenderProcessHostPrivilege GetProcessPrivilege( | 197 RenderProcessHostPrivilege GetProcessPrivilege( |
| 198 RenderProcessHost* process_host, | 198 RenderProcessHost* process_host, |
| 199 extensions::ProcessMap* process_map, | 199 extensions::ProcessMap* process_map, |
| 200 ExtensionService* service) { | 200 ExtensionService* service) { |
| 201 // TODO(aa): It seems like hosted apps should be grouped separately from | 201 // TODO(aa): It seems like hosted apps should be grouped separately from |
| 202 // extensions: crbug.com/102533. | 202 // extensions: crbug.com/102533. |
| 203 std::set<std::string> extension_ids = | 203 std::set<std::string> extension_ids = |
| 204 process_map->GetExtensionsInProcess(process_host->id()); | 204 process_map->GetExtensionsInProcess(process_host->GetID()); |
| 205 if (extension_ids.empty()) | 205 if (extension_ids.empty()) |
| 206 return PRIV_NORMAL; | 206 return PRIV_NORMAL; |
| 207 | 207 |
| 208 for (std::set<std::string>::iterator iter = extension_ids.begin(); | 208 for (std::set<std::string>::iterator iter = extension_ids.begin(); |
| 209 iter != extension_ids.end(); ++iter) { | 209 iter != extension_ids.end(); ++iter) { |
| 210 const Extension* extension = service->GetExtensionById(*iter, false); | 210 const Extension* extension = service->GetExtensionById(*iter, false); |
| 211 if (extension && extension->is_storage_isolated()) | 211 if (extension && extension->is_storage_isolated()) |
| 212 return PRIV_ISOLATED; | 212 return PRIV_ISOLATED; |
| 213 } | 213 } |
| 214 | 214 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 SiteInstance* site_instance = render_view_host->site_instance(); | 297 SiteInstance* site_instance = render_view_host->site_instance(); |
| 298 Profile* profile = Profile::FromBrowserContext( | 298 Profile* profile = Profile::FromBrowserContext( |
| 299 site_instance->browsing_instance()->browser_context()); | 299 site_instance->browsing_instance()->browser_context()); |
| 300 | 300 |
| 301 new ChromeRenderViewHostObserver(render_view_host, | 301 new ChromeRenderViewHostObserver(render_view_host, |
| 302 profile->GetNetworkPredictor()); | 302 profile->GetNetworkPredictor()); |
| 303 new ExtensionMessageHandler(render_view_host); | 303 new ExtensionMessageHandler(render_view_host); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void ChromeContentBrowserClient::BrowserRenderProcessHostCreated( | 306 void ChromeContentBrowserClient::RenderProcessHostCreated( |
| 307 BrowserRenderProcessHost* host) { | 307 RenderProcessHost* host) { |
| 308 int id = host->id(); | 308 int id = host->GetID(); |
| 309 Profile* profile = Profile::FromBrowserContext(host->browser_context()); | 309 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 310 host->channel()->AddFilter(new ChromeRenderMessageFilter( | 310 host->GetChannel()->AddFilter(new ChromeRenderMessageFilter( |
| 311 id, profile, profile->GetRequestContextForRenderProcess(id))); | 311 id, profile, profile->GetRequestContextForRenderProcess(id))); |
| 312 host->channel()->AddFilter(new PluginInfoMessageFilter(id, profile)); | 312 host->GetChannel()->AddFilter(new PluginInfoMessageFilter(id, profile)); |
| 313 host->channel()->AddFilter(new PrintingMessageFilter()); | 313 host->GetChannel()->AddFilter(new PrintingMessageFilter()); |
| 314 host->channel()->AddFilter( | 314 host->GetChannel()->AddFilter( |
| 315 new SearchProviderInstallStateMessageFilter(id, profile)); | 315 new SearchProviderInstallStateMessageFilter(id, profile)); |
| 316 host->channel()->AddFilter(new SpellCheckMessageFilter(id)); | 316 host->GetChannel()->AddFilter(new SpellCheckMessageFilter(id)); |
| 317 host->channel()->AddFilter(new ChromeBenchmarkingMessageFilter( | 317 host->GetChannel()->AddFilter(new ChromeBenchmarkingMessageFilter( |
| 318 id, profile, profile->GetRequestContextForRenderProcess(id))); | 318 id, profile, profile->GetRequestContextForRenderProcess(id))); |
| 319 | 319 |
| 320 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 320 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
| 321 profile->IsOffTheRecord())); | 321 profile->IsOffTheRecord())); |
| 322 | 322 |
| 323 SendExtensionWebRequestStatusToHost(host); | 323 SendExtensionWebRequestStatusToHost(host); |
| 324 | 324 |
| 325 RendererContentSettingRules rules; | 325 RendererContentSettingRules rules; |
| 326 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); | 326 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); |
| 327 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 327 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return url == GURL(chrome::kChromeUICrashURL) || | 390 return url == GURL(chrome::kChromeUICrashURL) || |
| 391 url == GURL(chrome::kChromeUIKillURL) || | 391 url == GURL(chrome::kChromeUIKillURL) || |
| 392 url == GURL(chrome::kChromeUIHangURL) || | 392 url == GURL(chrome::kChromeUIHangURL) || |
| 393 url == GURL(chrome::kChromeUIShorthangURL); | 393 url == GURL(chrome::kChromeUIShorthangURL); |
| 394 } | 394 } |
| 395 | 395 |
| 396 bool ChromeContentBrowserClient::IsSuitableHost( | 396 bool ChromeContentBrowserClient::IsSuitableHost( |
| 397 RenderProcessHost* process_host, | 397 RenderProcessHost* process_host, |
| 398 const GURL& site_url) { | 398 const GURL& site_url) { |
| 399 Profile* profile = | 399 Profile* profile = |
| 400 Profile::FromBrowserContext(process_host->browser_context()); | 400 Profile::FromBrowserContext(process_host->GetBrowserContext()); |
| 401 ExtensionService* service = profile->GetExtensionService(); | 401 ExtensionService* service = profile->GetExtensionService(); |
| 402 extensions::ProcessMap* process_map = service->process_map(); | 402 extensions::ProcessMap* process_map = service->process_map(); |
| 403 | 403 |
| 404 // These may be NULL during tests. In that case, just assume any site can | 404 // These may be NULL during tests. In that case, just assume any site can |
| 405 // share any host. | 405 // share any host. |
| 406 if (!service || !process_map) | 406 if (!service || !process_map) |
| 407 return true; | 407 return true; |
| 408 | 408 |
| 409 // Experimental: | 409 // Experimental: |
| 410 // If --enable-strict-site-isolation is enabled, do not allow non-WebUI pages | 410 // If --enable-strict-site-isolation is enabled, do not allow non-WebUI pages |
| (...skipping 20 matching lines...) Expand all Loading... |
| 431 return; | 431 return; |
| 432 | 432 |
| 433 const Extension* extension = | 433 const Extension* extension = |
| 434 service->GetExtensionByURL(site_instance->site()); | 434 service->GetExtensionByURL(site_instance->site()); |
| 435 if (!extension) | 435 if (!extension) |
| 436 extension = service->GetExtensionByWebExtent(site_instance->site()); | 436 extension = service->GetExtensionByWebExtent(site_instance->site()); |
| 437 if (!extension) | 437 if (!extension) |
| 438 return; | 438 return; |
| 439 | 439 |
| 440 service->process_map()->Insert( | 440 service->process_map()->Insert( |
| 441 extension->id(), site_instance->GetProcess()->id()); | 441 extension->id(), site_instance->GetProcess()->GetID()); |
| 442 BrowserThread::PostTask( | 442 BrowserThread::PostTask( |
| 443 BrowserThread::IO, FROM_HERE, | 443 BrowserThread::IO, FROM_HERE, |
| 444 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 444 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
| 445 profile->GetExtensionInfoMap(), | 445 profile->GetExtensionInfoMap(), |
| 446 extension->id(), | 446 extension->id(), |
| 447 site_instance->GetProcess()->id())); | 447 site_instance->GetProcess()->GetID())); |
| 448 } | 448 } |
| 449 | 449 |
| 450 void ChromeContentBrowserClient::SiteInstanceDeleting( | 450 void ChromeContentBrowserClient::SiteInstanceDeleting( |
| 451 SiteInstance* site_instance) { | 451 SiteInstance* site_instance) { |
| 452 if (!site_instance->HasProcess()) | 452 if (!site_instance->HasProcess()) |
| 453 return; | 453 return; |
| 454 | 454 |
| 455 Profile* profile = Profile::FromBrowserContext( | 455 Profile* profile = Profile::FromBrowserContext( |
| 456 site_instance->browsing_instance()->browser_context()); | 456 site_instance->browsing_instance()->browser_context()); |
| 457 ExtensionService* service = profile->GetExtensionService(); | 457 ExtensionService* service = profile->GetExtensionService(); |
| 458 if (!service) | 458 if (!service) |
| 459 return; | 459 return; |
| 460 | 460 |
| 461 const Extension* extension = | 461 const Extension* extension = |
| 462 service->GetExtensionByURL(site_instance->site()); | 462 service->GetExtensionByURL(site_instance->site()); |
| 463 if (!extension) | 463 if (!extension) |
| 464 extension = service->GetExtensionByWebExtent(site_instance->site()); | 464 extension = service->GetExtensionByWebExtent(site_instance->site()); |
| 465 if (!extension) | 465 if (!extension) |
| 466 return; | 466 return; |
| 467 | 467 |
| 468 service->process_map()->Remove( | 468 service->process_map()->Remove( |
| 469 extension->id(), site_instance->GetProcess()->id()); | 469 extension->id(), site_instance->GetProcess()->GetID()); |
| 470 BrowserThread::PostTask( | 470 BrowserThread::PostTask( |
| 471 BrowserThread::IO, FROM_HERE, | 471 BrowserThread::IO, FROM_HERE, |
| 472 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, | 472 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, |
| 473 profile->GetExtensionInfoMap(), | 473 profile->GetExtensionInfoMap(), |
| 474 extension->id(), | 474 extension->id(), |
| 475 site_instance->GetProcess()->id())); | 475 site_instance->GetProcess()->GetID())); |
| 476 } | 476 } |
| 477 | 477 |
| 478 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( | 478 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( |
| 479 const GURL& current_url, | 479 const GURL& current_url, |
| 480 const GURL& new_url) { | 480 const GURL& new_url) { |
| 481 if (current_url.is_empty()) { | 481 if (current_url.is_empty()) { |
| 482 // Always choose a new process when navigating to extension URLs. The | 482 // Always choose a new process when navigating to extension URLs. The |
| 483 // process grouping logic will combine all of a given extension's pages | 483 // process grouping logic will combine all of a given extension's pages |
| 484 // into the same process. | 484 // into the same process. |
| 485 if (new_url.SchemeIs(chrome::kExtensionScheme)) | 485 if (new_url.SchemeIs(chrome::kExtensionScheme)) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 531 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
| 532 #if defined(OS_CHROMEOS) | 532 #if defined(OS_CHROMEOS) |
| 533 const std::string& login_profile = | 533 const std::string& login_profile = |
| 534 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); | 534 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); |
| 535 if (!login_profile.empty()) | 535 if (!login_profile.empty()) |
| 536 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); | 536 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); |
| 537 #endif | 537 #endif |
| 538 | 538 |
| 539 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); | 539 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); |
| 540 | 540 |
| 541 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 541 Profile* profile = Profile::FromBrowserContext( |
| 542 process->GetBrowserContext()); |
| 542 extensions::ProcessMap* process_map = | 543 extensions::ProcessMap* process_map = |
| 543 profile->GetExtensionService()->process_map(); | 544 profile->GetExtensionService()->process_map(); |
| 544 if (process_map && process_map->Contains(process->id())) | 545 if (process_map && process_map->Contains(process->GetID())) |
| 545 command_line->AppendSwitch(switches::kExtensionProcess); | 546 command_line->AppendSwitch(switches::kExtensionProcess); |
| 546 | 547 |
| 547 PrefService* prefs = profile->GetPrefs(); | 548 PrefService* prefs = profile->GetPrefs(); |
| 548 // Currently this pref is only registered if applied via a policy. | 549 // Currently this pref is only registered if applied via a policy. |
| 549 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && | 550 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && |
| 550 prefs->GetBoolean(prefs::kDisable3DAPIs)) { | 551 prefs->GetBoolean(prefs::kDisable3DAPIs)) { |
| 551 // Turn this policy into a command line switch. | 552 // Turn this policy into a command line switch. |
| 552 command_line->AppendSwitch(switches::kDisable3DAPIs); | 553 command_line->AppendSwitch(switches::kDisable3DAPIs); |
| 553 } | 554 } |
| 554 | 555 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 int render_process_id, | 878 int render_process_id, |
| 878 int render_view_id) { | 879 int render_view_id) { |
| 879 RenderViewHost* rvh = RenderViewHost::FromID( | 880 RenderViewHost* rvh = RenderViewHost::FromID( |
| 880 render_process_id, render_view_id); | 881 render_process_id, render_view_id); |
| 881 if (!rvh) { | 882 if (!rvh) { |
| 882 NOTREACHED(); | 883 NOTREACHED(); |
| 883 return; | 884 return; |
| 884 } | 885 } |
| 885 | 886 |
| 886 RenderProcessHost* process = rvh->process(); | 887 RenderProcessHost* process = rvh->process(); |
| 887 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 888 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
| 888 DesktopNotificationService* service = | 889 DesktopNotificationService* service = |
| 889 DesktopNotificationServiceFactory::GetForProfile(profile); | 890 DesktopNotificationServiceFactory::GetForProfile(profile); |
| 890 service->RequestPermission( | 891 service->RequestPermission( |
| 891 source_origin, render_process_id, render_view_id, callback_context, | 892 source_origin, render_process_id, render_view_id, callback_context, |
| 892 tab_util::GetTabContentsByID(render_process_id, render_view_id)); | 893 tab_util::GetTabContentsByID(render_process_id, render_view_id)); |
| 893 } | 894 } |
| 894 | 895 |
| 895 WebKit::WebNotificationPresenter::Permission | 896 WebKit::WebNotificationPresenter::Permission |
| 896 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 897 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
| 897 const GURL& source_origin, | 898 const GURL& source_origin, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 919 int render_view_id, | 920 int render_view_id, |
| 920 bool worker) { | 921 bool worker) { |
| 921 RenderViewHost* rvh = RenderViewHost::FromID( | 922 RenderViewHost* rvh = RenderViewHost::FromID( |
| 922 render_process_id, render_view_id); | 923 render_process_id, render_view_id); |
| 923 if (!rvh) { | 924 if (!rvh) { |
| 924 NOTREACHED(); | 925 NOTREACHED(); |
| 925 return; | 926 return; |
| 926 } | 927 } |
| 927 | 928 |
| 928 RenderProcessHost* process = rvh->process(); | 929 RenderProcessHost* process = rvh->process(); |
| 929 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 930 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
| 930 DesktopNotificationService* service = | 931 DesktopNotificationService* service = |
| 931 DesktopNotificationServiceFactory::GetForProfile(profile); | 932 DesktopNotificationServiceFactory::GetForProfile(profile); |
| 932 service->ShowDesktopNotification( | 933 service->ShowDesktopNotification( |
| 933 params, render_process_id, render_view_id, | 934 params, render_process_id, render_view_id, |
| 934 worker ? DesktopNotificationService::WorkerNotification : | 935 worker ? DesktopNotificationService::WorkerNotification : |
| 935 DesktopNotificationService::PageNotification); | 936 DesktopNotificationService::PageNotification); |
| 936 } | 937 } |
| 937 | 938 |
| 938 void ChromeContentBrowserClient::CancelDesktopNotification( | 939 void ChromeContentBrowserClient::CancelDesktopNotification( |
| 939 int render_process_id, | 940 int render_process_id, |
| 940 int render_view_id, | 941 int render_view_id, |
| 941 int notification_id) { | 942 int notification_id) { |
| 942 RenderViewHost* rvh = RenderViewHost::FromID( | 943 RenderViewHost* rvh = RenderViewHost::FromID( |
| 943 render_process_id, render_view_id); | 944 render_process_id, render_view_id); |
| 944 if (!rvh) { | 945 if (!rvh) { |
| 945 NOTREACHED(); | 946 NOTREACHED(); |
| 946 return; | 947 return; |
| 947 } | 948 } |
| 948 | 949 |
| 949 RenderProcessHost* process = rvh->process(); | 950 RenderProcessHost* process = rvh->process(); |
| 950 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 951 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
| 951 DesktopNotificationService* service = | 952 DesktopNotificationService* service = |
| 952 DesktopNotificationServiceFactory::GetForProfile(profile); | 953 DesktopNotificationServiceFactory::GetForProfile(profile); |
| 953 service->CancelDesktopNotification( | 954 service->CancelDesktopNotification( |
| 954 render_process_id, render_view_id, notification_id); | 955 render_process_id, render_view_id, notification_id); |
| 955 } | 956 } |
| 956 | 957 |
| 957 bool ChromeContentBrowserClient::CanCreateWindow( | 958 bool ChromeContentBrowserClient::CanCreateWindow( |
| 958 const GURL& source_origin, | 959 const GURL& source_origin, |
| 959 WindowContainerType container_type, | 960 WindowContainerType container_type, |
| 960 const content::ResourceContext& context, | 961 const content::ResourceContext& context, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 return !browser_command_line.HasSwitch(switches::kChromeFrame); | 1020 return !browser_command_line.HasSwitch(switches::kChromeFrame); |
| 1020 } | 1021 } |
| 1021 | 1022 |
| 1022 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(RenderViewHost* rvh) { | 1023 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(RenderViewHost* rvh) { |
| 1023 return RenderViewHostDelegateHelper::GetWebkitPrefs(rvh); | 1024 return RenderViewHostDelegateHelper::GetWebkitPrefs(rvh); |
| 1024 } | 1025 } |
| 1025 | 1026 |
| 1026 void ChromeContentBrowserClient::UpdateInspectorSetting( | 1027 void ChromeContentBrowserClient::UpdateInspectorSetting( |
| 1027 RenderViewHost* rvh, const std::string& key, const std::string& value) { | 1028 RenderViewHost* rvh, const std::string& key, const std::string& value) { |
| 1028 RenderViewHostDelegateHelper::UpdateInspectorSetting( | 1029 RenderViewHostDelegateHelper::UpdateInspectorSetting( |
| 1029 rvh->process()->browser_context(), key, value); | 1030 rvh->process()->GetBrowserContext(), key, value); |
| 1030 } | 1031 } |
| 1031 | 1032 |
| 1032 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { | 1033 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { |
| 1033 RenderViewHostDelegateHelper::ClearInspectorSettings( | 1034 RenderViewHostDelegateHelper::ClearInspectorSettings( |
| 1034 rvh->process()->browser_context()); | 1035 rvh->process()->GetBrowserContext()); |
| 1035 } | 1036 } |
| 1036 | 1037 |
| 1037 void ChromeContentBrowserClient::BrowserURLHandlerCreated( | 1038 void ChromeContentBrowserClient::BrowserURLHandlerCreated( |
| 1038 BrowserURLHandler* handler) { | 1039 BrowserURLHandler* handler) { |
| 1039 // Add the default URL handlers. | 1040 // Add the default URL handlers. |
| 1040 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, | 1041 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, |
| 1041 BrowserURLHandler::null_handler()); | 1042 BrowserURLHandler::null_handler()); |
| 1042 handler->AddHandlerPair(BrowserURLHandler::null_handler(), | 1043 handler->AddHandlerPair(BrowserURLHandler::null_handler(), |
| 1043 &ExtensionWebUI::HandleChromeURLOverrideReverse); | 1044 &ExtensionWebUI::HandleChromeURLOverrideReverse); |
| 1044 | 1045 |
| 1045 // about: | 1046 // about: |
| 1046 handler->AddHandlerPair(&WillHandleBrowserAboutURL, | 1047 handler->AddHandlerPair(&WillHandleBrowserAboutURL, |
| 1047 BrowserURLHandler::null_handler()); | 1048 BrowserURLHandler::null_handler()); |
| 1048 // chrome: & friends. | 1049 // chrome: & friends. |
| 1049 handler->AddHandlerPair(&HandleWebUI, | 1050 handler->AddHandlerPair(&HandleWebUI, |
| 1050 BrowserURLHandler::null_handler()); | 1051 BrowserURLHandler::null_handler()); |
| 1051 } | 1052 } |
| 1052 | 1053 |
| 1053 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { | 1054 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { |
| 1054 Profile* profile = Profile::FromBrowserContext( | 1055 Profile* profile = Profile::FromBrowserContext( |
| 1055 rvh->site_instance()->GetProcess()->browser_context()); | 1056 rvh->site_instance()->GetProcess()->GetBrowserContext()); |
| 1056 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, | 1057 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
| 1057 BrowsingDataRemover::EVERYTHING, | 1058 BrowsingDataRemover::EVERYTHING, |
| 1058 base::Time()); | 1059 base::Time()); |
| 1059 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); | 1060 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); |
| 1060 // BrowsingDataRemover takes care of deleting itself when done. | 1061 // BrowsingDataRemover takes care of deleting itself when done. |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1063 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { | 1064 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { |
| 1064 Profile* profile = Profile::FromBrowserContext( | 1065 Profile* profile = Profile::FromBrowserContext( |
| 1065 rvh->site_instance()->GetProcess()->browser_context()); | 1066 rvh->site_instance()->GetProcess()->GetBrowserContext()); |
| 1066 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, | 1067 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
| 1067 BrowsingDataRemover::EVERYTHING, | 1068 BrowsingDataRemover::EVERYTHING, |
| 1068 base::Time()); | 1069 base::Time()); |
| 1069 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; | 1070 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; |
| 1070 remover->Remove(remove_mask); | 1071 remover->Remove(remove_mask); |
| 1071 // BrowsingDataRemover takes care of deleting itself when done. | 1072 // BrowsingDataRemover takes care of deleting itself when done. |
| 1072 } | 1073 } |
| 1073 | 1074 |
| 1074 FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { | 1075 FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { |
| 1075 return download_util::GetDefaultDownloadDirectory(); | 1076 return download_util::GetDefaultDownloadDirectory(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 #if defined(USE_NSS) | 1117 #if defined(USE_NSS) |
| 1117 crypto::CryptoModuleBlockingPasswordDelegate* | 1118 crypto::CryptoModuleBlockingPasswordDelegate* |
| 1118 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1119 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1119 const GURL& url) { | 1120 const GURL& url) { |
| 1120 return browser::NewCryptoModuleBlockingDialogDelegate( | 1121 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 1121 browser::kCryptoModulePasswordKeygen, url.host()); | 1122 browser::kCryptoModulePasswordKeygen, url.host()); |
| 1122 } | 1123 } |
| 1123 #endif | 1124 #endif |
| 1124 | 1125 |
| 1125 } // namespace chrome | 1126 } // namespace chrome |
| OLD | NEW |