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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return PRIV_ISOLATED; | 188 return PRIV_ISOLATED; |
189 } | 189 } |
190 | 190 |
191 return PRIV_EXTENSION; | 191 return PRIV_EXTENSION; |
192 } | 192 } |
193 | 193 |
194 return PRIV_NORMAL; | 194 return PRIV_NORMAL; |
195 } | 195 } |
196 | 196 |
197 RenderProcessHostPrivilege GetProcessPrivilege( | 197 RenderProcessHostPrivilege GetProcessPrivilege( |
198 RenderProcessHost* process_host, | 198 content::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 content::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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 bool ChromeContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { | 391 bool ChromeContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { |
392 return url == GURL(chrome::kChromeUICrashURL) || | 392 return url == GURL(chrome::kChromeUICrashURL) || |
393 url == GURL(chrome::kChromeUIKillURL) || | 393 url == GURL(chrome::kChromeUIKillURL) || |
394 url == GURL(chrome::kChromeUIHangURL) || | 394 url == GURL(chrome::kChromeUIHangURL) || |
395 url == GURL(chrome::kChromeUIShorthangURL); | 395 url == GURL(chrome::kChromeUIShorthangURL); |
396 } | 396 } |
397 | 397 |
398 bool ChromeContentBrowserClient::IsSuitableHost( | 398 bool ChromeContentBrowserClient::IsSuitableHost( |
399 RenderProcessHost* process_host, | 399 content::RenderProcessHost* process_host, |
400 const GURL& site_url) { | 400 const GURL& site_url) { |
401 Profile* profile = | 401 Profile* profile = |
402 Profile::FromBrowserContext(process_host->browser_context()); | 402 Profile::FromBrowserContext(process_host->GetBrowserContext()); |
403 ExtensionService* service = profile->GetExtensionService(); | 403 ExtensionService* service = profile->GetExtensionService(); |
404 extensions::ProcessMap* process_map = service->process_map(); | 404 extensions::ProcessMap* process_map = service->process_map(); |
405 | 405 |
406 // Don't allow the Task Manager to share a process with anything else. | 406 // Don't allow the Task Manager to share a process with anything else. |
407 // Otherwise it can affect the renderers it is observing. | 407 // Otherwise it can affect the renderers it is observing. |
408 // Note: we could create another RenderProcessHostPrivilege bucket for | 408 // Note: we could create another RenderProcessHostPrivilege bucket for |
409 // this to allow multiple chrome://tasks instances to share, but that's | 409 // this to allow multiple chrome://tasks instances to share, but that's |
410 // a very unlikely case without serious consequences. | 410 // a very unlikely case without serious consequences. |
411 if (site_url.GetOrigin() == GURL(chrome::kChromeUITaskManagerURL).GetOrigin()) | 411 if (site_url.GetOrigin() == GURL(chrome::kChromeUITaskManagerURL).GetOrigin()) |
412 return false; | 412 return false; |
(...skipping 28 matching lines...) Expand all Loading... |
441 return; | 441 return; |
442 | 442 |
443 const Extension* extension = | 443 const Extension* extension = |
444 service->GetExtensionByURL(site_instance->site()); | 444 service->GetExtensionByURL(site_instance->site()); |
445 if (!extension) | 445 if (!extension) |
446 extension = service->GetExtensionByWebExtent(site_instance->site()); | 446 extension = service->GetExtensionByWebExtent(site_instance->site()); |
447 if (!extension) | 447 if (!extension) |
448 return; | 448 return; |
449 | 449 |
450 service->process_map()->Insert( | 450 service->process_map()->Insert( |
451 extension->id(), site_instance->GetProcess()->id()); | 451 extension->id(), site_instance->GetProcess()->GetID()); |
452 BrowserThread::PostTask( | 452 BrowserThread::PostTask( |
453 BrowserThread::IO, FROM_HERE, | 453 BrowserThread::IO, FROM_HERE, |
454 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 454 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
455 profile->GetExtensionInfoMap(), | 455 profile->GetExtensionInfoMap(), |
456 extension->id(), | 456 extension->id(), |
457 site_instance->GetProcess()->id())); | 457 site_instance->GetProcess()->GetID())); |
458 } | 458 } |
459 | 459 |
460 void ChromeContentBrowserClient::SiteInstanceDeleting( | 460 void ChromeContentBrowserClient::SiteInstanceDeleting( |
461 SiteInstance* site_instance) { | 461 SiteInstance* site_instance) { |
462 if (!site_instance->HasProcess()) | 462 if (!site_instance->HasProcess()) |
463 return; | 463 return; |
464 | 464 |
465 Profile* profile = Profile::FromBrowserContext( | 465 Profile* profile = Profile::FromBrowserContext( |
466 site_instance->browsing_instance()->browser_context()); | 466 site_instance->browsing_instance()->browser_context()); |
467 ExtensionService* service = profile->GetExtensionService(); | 467 ExtensionService* service = profile->GetExtensionService(); |
468 if (!service) | 468 if (!service) |
469 return; | 469 return; |
470 | 470 |
471 const Extension* extension = | 471 const Extension* extension = |
472 service->GetExtensionByURL(site_instance->site()); | 472 service->GetExtensionByURL(site_instance->site()); |
473 if (!extension) | 473 if (!extension) |
474 extension = service->GetExtensionByWebExtent(site_instance->site()); | 474 extension = service->GetExtensionByWebExtent(site_instance->site()); |
475 if (!extension) | 475 if (!extension) |
476 return; | 476 return; |
477 | 477 |
478 service->process_map()->Remove( | 478 service->process_map()->Remove( |
479 extension->id(), site_instance->GetProcess()->id()); | 479 extension->id(), site_instance->GetProcess()->GetID()); |
480 BrowserThread::PostTask( | 480 BrowserThread::PostTask( |
481 BrowserThread::IO, FROM_HERE, | 481 BrowserThread::IO, FROM_HERE, |
482 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, | 482 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, |
483 profile->GetExtensionInfoMap(), | 483 profile->GetExtensionInfoMap(), |
484 extension->id(), | 484 extension->id(), |
485 site_instance->GetProcess()->id())); | 485 site_instance->GetProcess()->GetID())); |
486 } | 486 } |
487 | 487 |
488 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( | 488 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( |
489 const GURL& current_url, | 489 const GURL& current_url, |
490 const GURL& new_url) { | 490 const GURL& new_url) { |
491 if (current_url.is_empty()) { | 491 if (current_url.is_empty()) { |
492 // Always choose a new process when navigating to extension URLs. The | 492 // Always choose a new process when navigating to extension URLs. The |
493 // process grouping logic will combine all of a given extension's pages | 493 // process grouping logic will combine all of a given extension's pages |
494 // into the same process. | 494 // into the same process. |
495 if (new_url.SchemeIs(chrome::kExtensionScheme)) | 495 if (new_url.SchemeIs(chrome::kExtensionScheme)) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); | 539 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); |
540 if (!user_data_dir.empty()) | 540 if (!user_data_dir.empty()) |
541 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 541 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
542 #if defined(OS_CHROMEOS) | 542 #if defined(OS_CHROMEOS) |
543 const std::string& login_profile = | 543 const std::string& login_profile = |
544 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); | 544 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); |
545 if (!login_profile.empty()) | 545 if (!login_profile.empty()) |
546 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); | 546 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); |
547 #endif | 547 #endif |
548 | 548 |
549 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); | 549 content::RenderProcessHost* process = |
| 550 content::RenderProcessHost::FromID(child_process_id); |
550 | 551 |
551 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 552 Profile* profile = Profile::FromBrowserContext( |
| 553 process->GetBrowserContext()); |
552 extensions::ProcessMap* process_map = | 554 extensions::ProcessMap* process_map = |
553 profile->GetExtensionService()->process_map(); | 555 profile->GetExtensionService()->process_map(); |
554 if (process_map && process_map->Contains(process->id())) | 556 if (process_map && process_map->Contains(process->GetID())) |
555 command_line->AppendSwitch(switches::kExtensionProcess); | 557 command_line->AppendSwitch(switches::kExtensionProcess); |
556 | 558 |
557 PrefService* prefs = profile->GetPrefs(); | 559 PrefService* prefs = profile->GetPrefs(); |
558 // Currently this pref is only registered if applied via a policy. | 560 // Currently this pref is only registered if applied via a policy. |
559 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && | 561 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && |
560 prefs->GetBoolean(prefs::kDisable3DAPIs)) { | 562 prefs->GetBoolean(prefs::kDisable3DAPIs)) { |
561 // Turn this policy into a command line switch. | 563 // Turn this policy into a command line switch. |
562 command_line->AppendSwitch(switches::kDisable3DAPIs); | 564 command_line->AppendSwitch(switches::kDisable3DAPIs); |
563 } | 565 } |
564 | 566 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 int callback_context, | 888 int callback_context, |
887 int render_process_id, | 889 int render_process_id, |
888 int render_view_id) { | 890 int render_view_id) { |
889 RenderViewHost* rvh = RenderViewHost::FromID( | 891 RenderViewHost* rvh = RenderViewHost::FromID( |
890 render_process_id, render_view_id); | 892 render_process_id, render_view_id); |
891 if (!rvh) { | 893 if (!rvh) { |
892 NOTREACHED(); | 894 NOTREACHED(); |
893 return; | 895 return; |
894 } | 896 } |
895 | 897 |
896 RenderProcessHost* process = rvh->process(); | 898 content::RenderProcessHost* process = rvh->process(); |
897 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 899 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
898 DesktopNotificationService* service = | 900 DesktopNotificationService* service = |
899 DesktopNotificationServiceFactory::GetForProfile(profile); | 901 DesktopNotificationServiceFactory::GetForProfile(profile); |
900 service->RequestPermission( | 902 service->RequestPermission( |
901 source_origin, render_process_id, render_view_id, callback_context, | 903 source_origin, render_process_id, render_view_id, callback_context, |
902 tab_util::GetTabContentsByID(render_process_id, render_view_id)); | 904 tab_util::GetTabContentsByID(render_process_id, render_view_id)); |
903 } | 905 } |
904 | 906 |
905 WebKit::WebNotificationPresenter::Permission | 907 WebKit::WebNotificationPresenter::Permission |
906 ChromeContentBrowserClient::CheckDesktopNotificationPermission( | 908 ChromeContentBrowserClient::CheckDesktopNotificationPermission( |
907 const GURL& source_origin, | 909 const GURL& source_origin, |
(...skipping 20 matching lines...) Expand all Loading... |
928 int render_process_id, | 930 int render_process_id, |
929 int render_view_id, | 931 int render_view_id, |
930 bool worker) { | 932 bool worker) { |
931 RenderViewHost* rvh = RenderViewHost::FromID( | 933 RenderViewHost* rvh = RenderViewHost::FromID( |
932 render_process_id, render_view_id); | 934 render_process_id, render_view_id); |
933 if (!rvh) { | 935 if (!rvh) { |
934 NOTREACHED(); | 936 NOTREACHED(); |
935 return; | 937 return; |
936 } | 938 } |
937 | 939 |
938 RenderProcessHost* process = rvh->process(); | 940 content::RenderProcessHost* process = rvh->process(); |
939 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 941 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
940 DesktopNotificationService* service = | 942 DesktopNotificationService* service = |
941 DesktopNotificationServiceFactory::GetForProfile(profile); | 943 DesktopNotificationServiceFactory::GetForProfile(profile); |
942 service->ShowDesktopNotification( | 944 service->ShowDesktopNotification( |
943 params, render_process_id, render_view_id, | 945 params, render_process_id, render_view_id, |
944 worker ? DesktopNotificationService::WorkerNotification : | 946 worker ? DesktopNotificationService::WorkerNotification : |
945 DesktopNotificationService::PageNotification); | 947 DesktopNotificationService::PageNotification); |
946 } | 948 } |
947 | 949 |
948 void ChromeContentBrowserClient::CancelDesktopNotification( | 950 void ChromeContentBrowserClient::CancelDesktopNotification( |
949 int render_process_id, | 951 int render_process_id, |
950 int render_view_id, | 952 int render_view_id, |
951 int notification_id) { | 953 int notification_id) { |
952 RenderViewHost* rvh = RenderViewHost::FromID( | 954 RenderViewHost* rvh = RenderViewHost::FromID( |
953 render_process_id, render_view_id); | 955 render_process_id, render_view_id); |
954 if (!rvh) { | 956 if (!rvh) { |
955 NOTREACHED(); | 957 NOTREACHED(); |
956 return; | 958 return; |
957 } | 959 } |
958 | 960 |
959 RenderProcessHost* process = rvh->process(); | 961 content::RenderProcessHost* process = rvh->process(); |
960 Profile* profile = Profile::FromBrowserContext(process->browser_context()); | 962 Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); |
961 DesktopNotificationService* service = | 963 DesktopNotificationService* service = |
962 DesktopNotificationServiceFactory::GetForProfile(profile); | 964 DesktopNotificationServiceFactory::GetForProfile(profile); |
963 service->CancelDesktopNotification( | 965 service->CancelDesktopNotification( |
964 render_process_id, render_view_id, notification_id); | 966 render_process_id, render_view_id, notification_id); |
965 } | 967 } |
966 | 968 |
967 bool ChromeContentBrowserClient::CanCreateWindow( | 969 bool ChromeContentBrowserClient::CanCreateWindow( |
968 const GURL& source_origin, | 970 const GURL& source_origin, |
969 WindowContainerType container_type, | 971 WindowContainerType container_type, |
970 const content::ResourceContext& context, | 972 const content::ResourceContext& context, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 return !browser_command_line.HasSwitch(switches::kChromeFrame); | 1031 return !browser_command_line.HasSwitch(switches::kChromeFrame); |
1030 } | 1032 } |
1031 | 1033 |
1032 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(RenderViewHost* rvh) { | 1034 WebPreferences ChromeContentBrowserClient::GetWebkitPrefs(RenderViewHost* rvh) { |
1033 return RenderViewHostDelegateHelper::GetWebkitPrefs(rvh); | 1035 return RenderViewHostDelegateHelper::GetWebkitPrefs(rvh); |
1034 } | 1036 } |
1035 | 1037 |
1036 void ChromeContentBrowserClient::UpdateInspectorSetting( | 1038 void ChromeContentBrowserClient::UpdateInspectorSetting( |
1037 RenderViewHost* rvh, const std::string& key, const std::string& value) { | 1039 RenderViewHost* rvh, const std::string& key, const std::string& value) { |
1038 RenderViewHostDelegateHelper::UpdateInspectorSetting( | 1040 RenderViewHostDelegateHelper::UpdateInspectorSetting( |
1039 rvh->process()->browser_context(), key, value); | 1041 rvh->process()->GetBrowserContext(), key, value); |
1040 } | 1042 } |
1041 | 1043 |
1042 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { | 1044 void ChromeContentBrowserClient::ClearInspectorSettings(RenderViewHost* rvh) { |
1043 RenderViewHostDelegateHelper::ClearInspectorSettings( | 1045 RenderViewHostDelegateHelper::ClearInspectorSettings( |
1044 rvh->process()->browser_context()); | 1046 rvh->process()->GetBrowserContext()); |
1045 } | 1047 } |
1046 | 1048 |
1047 void ChromeContentBrowserClient::BrowserURLHandlerCreated( | 1049 void ChromeContentBrowserClient::BrowserURLHandlerCreated( |
1048 BrowserURLHandler* handler) { | 1050 BrowserURLHandler* handler) { |
1049 // Add the default URL handlers. | 1051 // Add the default URL handlers. |
1050 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, | 1052 handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, |
1051 BrowserURLHandler::null_handler()); | 1053 BrowserURLHandler::null_handler()); |
1052 handler->AddHandlerPair(BrowserURLHandler::null_handler(), | 1054 handler->AddHandlerPair(BrowserURLHandler::null_handler(), |
1053 &ExtensionWebUI::HandleChromeURLOverrideReverse); | 1055 &ExtensionWebUI::HandleChromeURLOverrideReverse); |
1054 | 1056 |
1055 // about: | 1057 // about: |
1056 handler->AddHandlerPair(&WillHandleBrowserAboutURL, | 1058 handler->AddHandlerPair(&WillHandleBrowserAboutURL, |
1057 BrowserURLHandler::null_handler()); | 1059 BrowserURLHandler::null_handler()); |
1058 // chrome: & friends. | 1060 // chrome: & friends. |
1059 handler->AddHandlerPair(&HandleWebUI, | 1061 handler->AddHandlerPair(&HandleWebUI, |
1060 BrowserURLHandler::null_handler()); | 1062 BrowserURLHandler::null_handler()); |
1061 } | 1063 } |
1062 | 1064 |
1063 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { | 1065 void ChromeContentBrowserClient::ClearCache(RenderViewHost* rvh) { |
1064 Profile* profile = Profile::FromBrowserContext( | 1066 Profile* profile = Profile::FromBrowserContext( |
1065 rvh->site_instance()->GetProcess()->browser_context()); | 1067 rvh->site_instance()->GetProcess()->GetBrowserContext()); |
1066 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, | 1068 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
1067 BrowsingDataRemover::EVERYTHING, | 1069 BrowsingDataRemover::EVERYTHING, |
1068 base::Time()); | 1070 base::Time()); |
1069 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); | 1071 remover->Remove(BrowsingDataRemover::REMOVE_CACHE); |
1070 // BrowsingDataRemover takes care of deleting itself when done. | 1072 // BrowsingDataRemover takes care of deleting itself when done. |
1071 } | 1073 } |
1072 | 1074 |
1073 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { | 1075 void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { |
1074 Profile* profile = Profile::FromBrowserContext( | 1076 Profile* profile = Profile::FromBrowserContext( |
1075 rvh->site_instance()->GetProcess()->browser_context()); | 1077 rvh->site_instance()->GetProcess()->GetBrowserContext()); |
1076 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, | 1078 BrowsingDataRemover* remover = new BrowsingDataRemover(profile, |
1077 BrowsingDataRemover::EVERYTHING, | 1079 BrowsingDataRemover::EVERYTHING, |
1078 base::Time()); | 1080 base::Time()); |
1079 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; | 1081 int remove_mask = BrowsingDataRemover::REMOVE_SITE_DATA; |
1080 remover->Remove(remove_mask); | 1082 remover->Remove(remove_mask); |
1081 // BrowsingDataRemover takes care of deleting itself when done. | 1083 // BrowsingDataRemover takes care of deleting itself when done. |
1082 } | 1084 } |
1083 | 1085 |
1084 FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { | 1086 FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { |
1085 return download_util::GetDefaultDownloadDirectory(); | 1087 return download_util::GetDefaultDownloadDirectory(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 #if defined(USE_NSS) | 1128 #if defined(USE_NSS) |
1127 crypto::CryptoModuleBlockingPasswordDelegate* | 1129 crypto::CryptoModuleBlockingPasswordDelegate* |
1128 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1130 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
1129 const GURL& url) { | 1131 const GURL& url) { |
1130 return browser::NewCryptoModuleBlockingDialogDelegate( | 1132 return browser::NewCryptoModuleBlockingDialogDelegate( |
1131 browser::kCryptoModulePasswordKeygen, url.host()); | 1133 browser::kCryptoModulePasswordKeygen, url.host()); |
1132 } | 1134 } |
1133 #endif | 1135 #endif |
1134 | 1136 |
1135 } // namespace chrome | 1137 } // namespace chrome |
OLD | NEW |