| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 if (SharedModuleInfo::IsSharedModule(extension)) | 2039 if (SharedModuleInfo::IsSharedModule(extension)) |
| 2040 MaybeFinishDelayedInstallations(); | 2040 MaybeFinishDelayedInstallations(); |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 const Extension* ExtensionService::GetPendingExtensionUpdate( | 2043 const Extension* ExtensionService::GetPendingExtensionUpdate( |
| 2044 const std::string& id) const { | 2044 const std::string& id) const { |
| 2045 return delayed_installs_.GetByID(id); | 2045 return delayed_installs_.GetByID(id); |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 void ExtensionService::RegisterContentSettings( | 2048 void ExtensionService::RegisterContentSettings( |
| 2049 HostContentSettingsMap* host_content_settings_map) { | 2049 HostContentSettingsMap* host_content_settings_map, |
| 2050 Profile* profile) { |
| 2051 // Most extension services key off of the original profile. |
| 2052 Profile* original_profile = profile->GetOriginalProfile(); |
| 2053 |
| 2050 TRACE_EVENT0("browser,startup", "ExtensionService::RegisterContentSettings"); | 2054 TRACE_EVENT0("browser,startup", "ExtensionService::RegisterContentSettings"); |
| 2051 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2055 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2052 host_content_settings_map->RegisterProvider( | 2056 host_content_settings_map->RegisterProvider( |
| 2053 HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER, | 2057 HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER, |
| 2054 std::unique_ptr<content_settings::ObservableProvider>( | 2058 std::unique_ptr<content_settings::ObservableProvider>( |
| 2055 new content_settings::InternalExtensionProvider(profile_))); | 2059 new content_settings::InternalExtensionProvider(original_profile))); |
| 2056 | 2060 |
| 2057 host_content_settings_map->RegisterProvider( | 2061 host_content_settings_map->RegisterProvider( |
| 2058 HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER, | 2062 HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER, |
| 2059 std::unique_ptr<content_settings::ObservableProvider>( | 2063 std::unique_ptr<content_settings::ObservableProvider>( |
| 2060 new content_settings::CustomExtensionProvider( | 2064 new content_settings::CustomExtensionProvider( |
| 2061 extensions::ContentSettingsService::Get(profile_) | 2065 extensions::ContentSettingsService::Get(original_profile) |
| 2062 ->content_settings_store(), | 2066 ->content_settings_store(), |
| 2063 profile_->GetOriginalProfile() != profile_))); | 2067 // TODO(mmenke): CustomExtensionProvider expects this to be true |
| 2068 // for incognito profiles. |
| 2069 false))); |
| 2064 } | 2070 } |
| 2065 | 2071 |
| 2066 void ExtensionService::TrackTerminatedExtension( | 2072 void ExtensionService::TrackTerminatedExtension( |
| 2067 const std::string& extension_id) { | 2073 const std::string& extension_id) { |
| 2068 extensions_being_terminated_.erase(extension_id); | 2074 extensions_being_terminated_.erase(extension_id); |
| 2069 | 2075 |
| 2070 const Extension* extension = GetInstalledExtension(extension_id); | 2076 const Extension* extension = GetInstalledExtension(extension_id); |
| 2071 if (!extension) { | 2077 if (!extension) { |
| 2072 return; | 2078 return; |
| 2073 } | 2079 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 } | 2564 } |
| 2559 | 2565 |
| 2560 void ExtensionService::OnProfileDestructionStarted() { | 2566 void ExtensionService::OnProfileDestructionStarted() { |
| 2561 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2567 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2562 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2568 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2563 it != ids_to_unload.end(); | 2569 it != ids_to_unload.end(); |
| 2564 ++it) { | 2570 ++it) { |
| 2565 UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN); | 2571 UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN); |
| 2566 } | 2572 } |
| 2567 } | 2573 } |
| OLD | NEW |