OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/chrome_quota_permission_context.h" | 21 #include "chrome/browser/chrome_quota_permission_context.h" |
22 #include "chrome/browser/content_settings/content_settings_utils.h" | 22 #include "chrome/browser/content_settings/content_settings_utils.h" |
23 #include "chrome/browser/content_settings/cookie_settings.h" | 23 #include "chrome/browser/content_settings/cookie_settings.h" |
24 #include "chrome/browser/content_settings/host_content_settings_map.h" | 24 #include "chrome/browser/content_settings/host_content_settings_map.h" |
25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 25 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
26 #include "chrome/browser/download/download_util.h" | 26 #include "chrome/browser/download/download_util.h" |
27 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" | 27 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" |
28 #include "chrome/browser/extensions/extension_info_map.h" | 28 #include "chrome/browser/extensions/extension_info_map.h" |
29 #include "chrome/browser/extensions/extension_message_handler.h" | 29 #include "chrome/browser/extensions/extension_message_handler.h" |
30 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
| 31 #include "chrome/browser/extensions/extension_system.h" |
| 32 #include "chrome/browser/extensions/extension_system_factory.h" |
31 #include "chrome/browser/extensions/extension_web_ui.h" | 33 #include "chrome/browser/extensions/extension_web_ui.h" |
32 #include "chrome/browser/extensions/extension_webkit_preferences.h" | 34 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
33 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 35 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
34 #include "chrome/browser/google/google_util.h" | 36 #include "chrome/browser/google/google_util.h" |
35 #include "chrome/browser/net/chrome_net_log.h" | 37 #include "chrome/browser/net/chrome_net_log.h" |
36 #include "chrome/browser/notifications/desktop_notification_service.h" | 38 #include "chrome/browser/notifications/desktop_notification_service.h" |
37 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 39 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
38 #include "chrome/browser/platform_util.h" | 40 #include "chrome/browser/platform_util.h" |
39 #include "chrome/browser/prefs/pref_service.h" | 41 #include "chrome/browser/prefs/pref_service.h" |
40 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 42 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 site_instance->GetSite())); | 525 site_instance->GetSite())); |
524 if (!extension) | 526 if (!extension) |
525 return; | 527 return; |
526 | 528 |
527 service->process_map()->Insert(extension->id(), | 529 service->process_map()->Insert(extension->id(), |
528 site_instance->GetProcess()->GetID(), | 530 site_instance->GetProcess()->GetID(), |
529 site_instance->GetId()); | 531 site_instance->GetId()); |
530 BrowserThread::PostTask( | 532 BrowserThread::PostTask( |
531 BrowserThread::IO, FROM_HERE, | 533 BrowserThread::IO, FROM_HERE, |
532 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 534 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
533 profile->GetExtensionInfoMap(), | 535 ExtensionSystemFactory::GetForProfile(profile)->info_map(), |
534 extension->id(), | 536 extension->id(), |
535 site_instance->GetProcess()->GetID(), | 537 site_instance->GetProcess()->GetID(), |
536 site_instance->GetId())); | 538 site_instance->GetId())); |
537 } | 539 } |
538 | 540 |
539 void ChromeContentBrowserClient::SiteInstanceDeleting( | 541 void ChromeContentBrowserClient::SiteInstanceDeleting( |
540 SiteInstance* site_instance) { | 542 SiteInstance* site_instance) { |
541 if (!site_instance->HasProcess()) | 543 if (!site_instance->HasProcess()) |
542 return; | 544 return; |
543 | 545 |
544 Profile* profile = Profile::FromBrowserContext( | 546 Profile* profile = Profile::FromBrowserContext( |
545 site_instance->GetBrowserContext()); | 547 site_instance->GetBrowserContext()); |
546 ExtensionService* service = profile->GetExtensionService(); | 548 ExtensionService* service = profile->GetExtensionService(); |
547 if (!service) | 549 if (!service) |
548 return; | 550 return; |
549 | 551 |
550 const Extension* extension = | 552 const Extension* extension = |
551 service->extensions()->GetExtensionOrAppByURL( | 553 service->extensions()->GetExtensionOrAppByURL( |
552 ExtensionURLInfo(site_instance->GetSite())); | 554 ExtensionURLInfo(site_instance->GetSite())); |
553 if (!extension) | 555 if (!extension) |
554 return; | 556 return; |
555 | 557 |
556 service->process_map()->Remove(extension->id(), | 558 service->process_map()->Remove(extension->id(), |
557 site_instance->GetProcess()->GetID(), | 559 site_instance->GetProcess()->GetID(), |
558 site_instance->GetId()); | 560 site_instance->GetId()); |
559 BrowserThread::PostTask( | 561 BrowserThread::PostTask( |
560 BrowserThread::IO, FROM_HERE, | 562 BrowserThread::IO, FROM_HERE, |
561 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, | 563 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, |
562 profile->GetExtensionInfoMap(), | 564 ExtensionSystemFactory::GetForProfile(profile)->info_map(), |
563 extension->id(), | 565 extension->id(), |
564 site_instance->GetProcess()->GetID(), | 566 site_instance->GetProcess()->GetID(), |
565 site_instance->GetId())); | 567 site_instance->GetId())); |
566 } | 568 } |
567 | 569 |
568 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( | 570 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( |
569 const GURL& current_url, | 571 const GURL& current_url, |
570 const GURL& new_url) { | 572 const GURL& new_url) { |
571 if (current_url.is_empty()) { | 573 if (current_url.is_empty()) { |
572 // Always choose a new process when navigating to extension URLs. The | 574 // Always choose a new process when navigating to extension URLs. The |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 #if defined(USE_NSS) | 1401 #if defined(USE_NSS) |
1400 crypto::CryptoModuleBlockingPasswordDelegate* | 1402 crypto::CryptoModuleBlockingPasswordDelegate* |
1401 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1403 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
1402 const GURL& url) { | 1404 const GURL& url) { |
1403 return browser::NewCryptoModuleBlockingDialogDelegate( | 1405 return browser::NewCryptoModuleBlockingDialogDelegate( |
1404 browser::kCryptoModulePasswordKeygen, url.host()); | 1406 browser::kCryptoModulePasswordKeygen, url.host()); |
1405 } | 1407 } |
1406 #endif | 1408 #endif |
1407 | 1409 |
1408 } // namespace chrome | 1410 } // namespace chrome |
OLD | NEW |