Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 2866613003: Solve ProfileIOData, Extension, HostContentSettingsMap ordering issue. (Closed)
Patch Set: Response to comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 if (SharedModuleInfo::IsSharedModule(extension)) 2040 if (SharedModuleInfo::IsSharedModule(extension))
2041 MaybeFinishDelayedInstallations(); 2041 MaybeFinishDelayedInstallations();
2042 } 2042 }
2043 2043
2044 const Extension* ExtensionService::GetPendingExtensionUpdate( 2044 const Extension* ExtensionService::GetPendingExtensionUpdate(
2045 const std::string& id) const { 2045 const std::string& id) const {
2046 return delayed_installs_.GetByID(id); 2046 return delayed_installs_.GetByID(id);
2047 } 2047 }
2048 2048
2049 void ExtensionService::RegisterContentSettings( 2049 void ExtensionService::RegisterContentSettings(
2050 HostContentSettingsMap* host_content_settings_map) { 2050 HostContentSettingsMap* host_content_settings_map,
2051 Profile* profile) {
2052 // Most extension services key off of the original profile.
2053 Profile* profile = profile->GetOriginalProfile();
2054
2051 TRACE_EVENT0("browser,startup", "ExtensionService::RegisterContentSettings"); 2055 TRACE_EVENT0("browser,startup", "ExtensionService::RegisterContentSettings");
2052 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2056 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2053 host_content_settings_map->RegisterProvider( 2057 host_content_settings_map->RegisterProvider(
2054 HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER, 2058 HostContentSettingsMap::INTERNAL_EXTENSION_PROVIDER,
2055 std::unique_ptr<content_settings::ObservableProvider>( 2059 std::unique_ptr<content_settings::ObservableProvider>(
2056 new content_settings::InternalExtensionProvider(profile_))); 2060 new content_settings::InternalExtensionProvider(profile)));
2057 2061
2058 host_content_settings_map->RegisterProvider( 2062 host_content_settings_map->RegisterProvider(
2059 HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER, 2063 HostContentSettingsMap::CUSTOM_EXTENSION_PROVIDER,
2060 std::unique_ptr<content_settings::ObservableProvider>( 2064 std::unique_ptr<content_settings::ObservableProvider>(
2061 new content_settings::CustomExtensionProvider( 2065 new content_settings::CustomExtensionProvider(
2062 extensions::ContentSettingsService::Get(profile_) 2066 extensions::ContentSettingsService::Get(profile)
2063 ->content_settings_store(), 2067 ->content_settings_store(),
2064 profile_->GetOriginalProfile() != profile_))); 2068 profile->GetOriginalProfile() != profile)));
mmenke 2017/05/08 17:50:35 Is the comparison in line 2068 always true?
Devlin 2017/05/15 16:53:21 Yes, it will be. See also other comment.
2065 } 2069 }
2066 2070
2067 void ExtensionService::TrackTerminatedExtension( 2071 void ExtensionService::TrackTerminatedExtension(
2068 const std::string& extension_id) { 2072 const std::string& extension_id) {
2069 extensions_being_terminated_.erase(extension_id); 2073 extensions_being_terminated_.erase(extension_id);
2070 2074
2071 const Extension* extension = GetInstalledExtension(extension_id); 2075 const Extension* extension = GetInstalledExtension(extension_id);
2072 if (!extension) { 2076 if (!extension) {
2073 return; 2077 return;
2074 } 2078 }
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 } 2563 }
2560 2564
2561 void ExtensionService::OnProfileDestructionStarted() { 2565 void ExtensionService::OnProfileDestructionStarted() {
2562 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2566 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2563 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2567 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2564 it != ids_to_unload.end(); 2568 it != ids_to_unload.end();
2565 ++it) { 2569 ++it) {
2566 UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN); 2570 UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN);
2567 } 2571 }
2568 } 2572 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/profiles/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698