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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 CHECK(site_instance->HasProcess()); | 724 CHECK(site_instance->HasProcess()); |
725 | 725 |
726 Profile* profile = Profile::FromBrowserContext( | 726 Profile* profile = Profile::FromBrowserContext( |
727 site_instance->GetBrowserContext()); | 727 site_instance->GetBrowserContext()); |
728 ExtensionService* service = profile->GetExtensionService(); | 728 ExtensionService* service = profile->GetExtensionService(); |
729 if (!service) | 729 if (!service) |
730 return; | 730 return; |
731 | 731 |
732 const Extension* extension = | 732 const Extension* extension = |
733 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( | 733 service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo( |
734 site_instance->GetSite())); | 734 site_instance->GetSiteURL())); |
735 if (!extension) | 735 if (!extension) |
736 return; | 736 return; |
737 | 737 |
738 service->process_map()->Insert(extension->id(), | 738 service->process_map()->Insert(extension->id(), |
739 site_instance->GetProcess()->GetID(), | 739 site_instance->GetProcess()->GetID(), |
740 site_instance->GetId()); | 740 site_instance->GetId()); |
741 BrowserThread::PostTask( | 741 BrowserThread::PostTask( |
742 BrowserThread::IO, FROM_HERE, | 742 BrowserThread::IO, FROM_HERE, |
743 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, | 743 base::Bind(&ExtensionInfoMap::RegisterExtensionProcess, |
744 extensions::ExtensionSystem::Get(profile)->info_map(), | 744 extensions::ExtensionSystem::Get(profile)->info_map(), |
745 extension->id(), | 745 extension->id(), |
746 site_instance->GetProcess()->GetID(), | 746 site_instance->GetProcess()->GetID(), |
747 site_instance->GetId())); | 747 site_instance->GetId())); |
748 } | 748 } |
749 | 749 |
750 void ChromeContentBrowserClient::SiteInstanceDeleting( | 750 void ChromeContentBrowserClient::SiteInstanceDeleting( |
751 SiteInstance* site_instance) { | 751 SiteInstance* site_instance) { |
752 if (!site_instance->HasProcess()) | 752 if (!site_instance->HasProcess()) |
753 return; | 753 return; |
754 | 754 |
755 Profile* profile = Profile::FromBrowserContext( | 755 Profile* profile = Profile::FromBrowserContext( |
756 site_instance->GetBrowserContext()); | 756 site_instance->GetBrowserContext()); |
757 ExtensionService* service = profile->GetExtensionService(); | 757 ExtensionService* service = profile->GetExtensionService(); |
758 if (!service) | 758 if (!service) |
759 return; | 759 return; |
760 | 760 |
761 const Extension* extension = | 761 const Extension* extension = |
762 service->extensions()->GetExtensionOrAppByURL( | 762 service->extensions()->GetExtensionOrAppByURL( |
763 ExtensionURLInfo(site_instance->GetSite())); | 763 ExtensionURLInfo(site_instance->GetSiteURL())); |
764 if (!extension) | 764 if (!extension) |
765 return; | 765 return; |
766 | 766 |
767 service->process_map()->Remove(extension->id(), | 767 service->process_map()->Remove(extension->id(), |
768 site_instance->GetProcess()->GetID(), | 768 site_instance->GetProcess()->GetID(), |
769 site_instance->GetId()); | 769 site_instance->GetId()); |
770 BrowserThread::PostTask( | 770 BrowserThread::PostTask( |
771 BrowserThread::IO, FROM_HERE, | 771 BrowserThread::IO, FROM_HERE, |
772 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, | 772 base::Bind(&ExtensionInfoMap::UnregisterExtensionProcess, |
773 extensions::ExtensionSystem::Get(profile)->info_map(), | 773 extensions::ExtensionSystem::Get(profile)->info_map(), |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 prefs->ClearPref(prefs::kDefaultCharset); | 1570 prefs->ClearPref(prefs::kDefaultCharset); |
1571 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); | 1571 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); |
1572 } | 1572 } |
1573 DCHECK(!web_prefs->default_encoding.empty()); | 1573 DCHECK(!web_prefs->default_encoding.empty()); |
1574 | 1574 |
1575 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); | 1575 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
1576 chrome::ViewType view_type = chrome::GetViewType(web_contents); | 1576 chrome::ViewType view_type = chrome::GetViewType(web_contents); |
1577 ExtensionService* service = profile->GetExtensionService(); | 1577 ExtensionService* service = profile->GetExtensionService(); |
1578 if (service) { | 1578 if (service) { |
1579 const Extension* extension = service->extensions()->GetByID( | 1579 const Extension* extension = service->extensions()->GetByID( |
1580 rvh->GetSiteInstance()->GetSite().host()); | 1580 rvh->GetSiteInstance()->GetSiteURL().host()); |
1581 extension_webkit_preferences::SetPreferences( | 1581 extension_webkit_preferences::SetPreferences( |
1582 extension, view_type, web_prefs); | 1582 extension, view_type, web_prefs); |
1583 } | 1583 } |
1584 | 1584 |
1585 if (content::IsForceCompositingModeEnabled()) | 1585 if (content::IsForceCompositingModeEnabled()) |
1586 web_prefs->force_compositing_mode = true; | 1586 web_prefs->force_compositing_mode = true; |
1587 | 1587 |
1588 if (view_type == chrome::VIEW_TYPE_NOTIFICATION) { | 1588 if (view_type == chrome::VIEW_TYPE_NOTIFICATION) { |
1589 web_prefs->allow_scripts_to_close_windows = true; | 1589 web_prefs->allow_scripts_to_close_windows = true; |
1590 } else if (view_type == chrome::VIEW_TYPE_BACKGROUND_CONTENTS) { | 1590 } else if (view_type == chrome::VIEW_TYPE_BACKGROUND_CONTENTS) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 partition_id = extension->id(); | 1794 partition_id = extension->id(); |
1795 } | 1795 } |
1796 | 1796 |
1797 // Enforce that IsValidStoragePartitionId() implementation stays in sync. | 1797 // Enforce that IsValidStoragePartitionId() implementation stays in sync. |
1798 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); | 1798 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
1799 return partition_id; | 1799 return partition_id; |
1800 } | 1800 } |
1801 | 1801 |
1802 | 1802 |
1803 } // namespace chrome | 1803 } // namespace chrome |
OLD | NEW |