| 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 13 matching lines...) Expand all Loading... |
| 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/defaults.h" | 26 #include "chrome/browser/defaults.h" |
| 27 #include "chrome/browser/download/download_util.h" | 27 #include "chrome/browser/download/download_util.h" |
| 28 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" | 28 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" |
| 29 #include "chrome/browser/extensions/extension_host.h" | 29 #include "chrome/browser/extensions/extension_host.h" |
| 30 #include "chrome/browser/extensions/extension_info_map.h" | 30 #include "chrome/browser/extensions/extension_info_map.h" |
| 31 #include "chrome/browser/extensions/extension_message_handler.h" | 31 #include "chrome/browser/extensions/extension_message_handler.h" |
| 32 #include "chrome/browser/extensions/extension_process_manager.h" | 32 #include "chrome/browser/extensions/extension_process_manager.h" |
| 33 #include "chrome/browser/extensions/extension_service.h" | 33 #include "chrome/browser/extensions/extension_service.h" |
| 34 #include "chrome/browser/extensions/extension_system.h" |
| 35 #include "chrome/browser/extensions/extension_system_factory.h" |
| 34 #include "chrome/browser/extensions/extension_web_ui.h" | 36 #include "chrome/browser/extensions/extension_web_ui.h" |
| 35 #include "chrome/browser/extensions/extension_webkit_preferences.h" | 37 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
| 36 #include "chrome/browser/geolocation/chrome_access_token_store.h" | 38 #include "chrome/browser/geolocation/chrome_access_token_store.h" |
| 37 #include "chrome/browser/google/google_util.h" | 39 #include "chrome/browser/google/google_util.h" |
| 38 #include "chrome/browser/infobars/infobar_tab_helper.h" | 40 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 39 #include "chrome/browser/net/chrome_net_log.h" | 41 #include "chrome/browser/net/chrome_net_log.h" |
| 40 #include "chrome/browser/notifications/desktop_notification_service.h" | 42 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 41 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 43 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 42 #include "chrome/browser/platform_util.h" | 44 #include "chrome/browser/platform_util.h" |
| 43 #include "chrome/browser/prefs/pref_service.h" | 45 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 site_instance->GetSite())); | 595 site_instance->GetSite())); |
| 594 if (!extension) | 596 if (!extension) |
| 595 return; | 597 return; |
| 596 | 598 |
| 597 service->process_map()->Insert(extension->id(), | 599 service->process_map()->Insert(extension->id(), |
| 598 site_instance->GetProcess()->GetID(), | 600 site_instance->GetProcess()->GetID(), |
| 599 site_instance->GetId()); | 601 site_instance->GetId()); |
| 600 BrowserThread::PostTask( | 602 BrowserThread::PostTask( |
| 601 BrowserThread::IO, FROM_HERE, | 603 BrowserThread::IO, FROM_HERE, |
| 602 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 604 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
| 603 profile->GetExtensionInfoMap(), | 605 ExtensionSystemFactory::GetForProfile(profile)->info_map(), |
| 604 extension->id(), | 606 extension->id(), |
| 605 site_instance->GetProcess()->GetID(), | 607 site_instance->GetProcess()->GetID(), |
| 606 site_instance->GetId())); | 608 site_instance->GetId())); |
| 607 } | 609 } |
| 608 | 610 |
| 609 void ChromeContentBrowserClient::SiteInstanceDeleting( | 611 void ChromeContentBrowserClient::SiteInstanceDeleting( |
| 610 SiteInstance* site_instance) { | 612 SiteInstance* site_instance) { |
| 611 if (!site_instance->HasProcess()) | 613 if (!site_instance->HasProcess()) |
| 612 return; | 614 return; |
| 613 | 615 |
| 614 Profile* profile = Profile::FromBrowserContext( | 616 Profile* profile = Profile::FromBrowserContext( |
| 615 site_instance->GetBrowserContext()); | 617 site_instance->GetBrowserContext()); |
| 616 ExtensionService* service = profile->GetExtensionService(); | 618 ExtensionService* service = profile->GetExtensionService(); |
| 617 if (!service) | 619 if (!service) |
| 618 return; | 620 return; |
| 619 | 621 |
| 620 const Extension* extension = | 622 const Extension* extension = |
| 621 service->extensions()->GetExtensionOrAppByURL( | 623 service->extensions()->GetExtensionOrAppByURL( |
| 622 ExtensionURLInfo(site_instance->GetSite())); | 624 ExtensionURLInfo(site_instance->GetSite())); |
| 623 if (!extension) | 625 if (!extension) |
| 624 return; | 626 return; |
| 625 | 627 |
| 626 service->process_map()->Remove(extension->id(), | 628 service->process_map()->Remove(extension->id(), |
| 627 site_instance->GetProcess()->GetID(), | 629 site_instance->GetProcess()->GetID(), |
| 628 site_instance->GetId()); | 630 site_instance->GetId()); |
| 629 BrowserThread::PostTask( | 631 BrowserThread::PostTask( |
| 630 BrowserThread::IO, FROM_HERE, | 632 BrowserThread::IO, FROM_HERE, |
| 631 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, | 633 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, |
| 632 profile->GetExtensionInfoMap(), | 634 ExtensionSystemFactory::GetForProfile(profile)->info_map(), |
| 633 extension->id(), | 635 extension->id(), |
| 634 site_instance->GetProcess()->GetID(), | 636 site_instance->GetProcess()->GetID(), |
| 635 site_instance->GetId())); | 637 site_instance->GetId())); |
| 636 } | 638 } |
| 637 | 639 |
| 638 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( | 640 bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( |
| 639 const GURL& current_url, | 641 const GURL& current_url, |
| 640 const GURL& new_url) { | 642 const GURL& new_url) { |
| 641 if (current_url.is_empty()) { | 643 if (current_url.is_empty()) { |
| 642 // Always choose a new process when navigating to extension URLs. The | 644 // Always choose a new process when navigating to extension URLs. The |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 #if defined(USE_NSS) | 1597 #if defined(USE_NSS) |
| 1596 crypto::CryptoModuleBlockingPasswordDelegate* | 1598 crypto::CryptoModuleBlockingPasswordDelegate* |
| 1597 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 1599 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 1598 const GURL& url) { | 1600 const GURL& url) { |
| 1599 return browser::NewCryptoModuleBlockingDialogDelegate( | 1601 return browser::NewCryptoModuleBlockingDialogDelegate( |
| 1600 browser::kCryptoModulePasswordKeygen, url.host()); | 1602 browser::kCryptoModulePasswordKeygen, url.host()); |
| 1601 } | 1603 } |
| 1602 #endif | 1604 #endif |
| 1603 | 1605 |
| 1604 } // namespace chrome | 1606 } // namespace chrome |
| OLD | NEW |