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

Side by Side Diff: chrome/browser/extensions/api/storage/managed_value_store_cache.cc

Issue 398083002: Add "UninstallReason" parameter to ExtensionRegistryObserver::OnExtensionUninstalled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix header file. Created 6 years, 5 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) 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/extensions/api/storage/managed_value_store_cache.h" 5 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual ~ExtensionTracker() {} 71 virtual ~ExtensionTracker() {}
72 72
73 private: 73 private:
74 // ExtensionRegistryObserver implementation. 74 // ExtensionRegistryObserver implementation.
75 virtual void OnExtensionWillBeInstalled( 75 virtual void OnExtensionWillBeInstalled(
76 content::BrowserContext* browser_context, 76 content::BrowserContext* browser_context,
77 const Extension* extension, 77 const Extension* extension,
78 bool is_update, 78 bool is_update,
79 bool from_ephemeral, 79 bool from_ephemeral,
80 const std::string& old_name) OVERRIDE; 80 const std::string& old_name) OVERRIDE;
81 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, 81 virtual void OnExtensionUninstalled(
82 const Extension* extension) OVERRIDE; 82 content::BrowserContext* browser_context,
83 const Extension* extension,
84 extensions::UninstallReason reason) OVERRIDE;
83 85
84 // Handler for the signal from ExtensionSystem::ready(). 86 // Handler for the signal from ExtensionSystem::ready().
85 void OnExtensionsReady(); 87 void OnExtensionsReady();
86 88
87 // Starts a schema load for all extensions that use managed storage. 89 // Starts a schema load for all extensions that use managed storage.
88 void LoadSchemas(scoped_ptr<ExtensionSet> added); 90 void LoadSchemas(scoped_ptr<ExtensionSet> added);
89 91
90 bool UsesManagedStorage(const Extension* extension) const; 92 bool UsesManagedStorage(const Extension* extension) const;
91 93
92 // Loads the schemas of the |extensions| and passes a ComponentMap to 94 // Loads the schemas of the |extensions| and passes a ComponentMap to
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // most once. 132 // most once.
131 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) 133 if (!ExtensionSystem::Get(profile_)->ready().is_signaled())
132 return; 134 return;
133 scoped_ptr<ExtensionSet> added(new ExtensionSet); 135 scoped_ptr<ExtensionSet> added(new ExtensionSet);
134 added->Insert(extension); 136 added->Insert(extension);
135 LoadSchemas(added.Pass()); 137 LoadSchemas(added.Pass());
136 } 138 }
137 139
138 void ManagedValueStoreCache::ExtensionTracker::OnExtensionUninstalled( 140 void ManagedValueStoreCache::ExtensionTracker::OnExtensionUninstalled(
139 content::BrowserContext* browser_context, 141 content::BrowserContext* browser_context,
140 const Extension* extension) { 142 const Extension* extension,
143 extensions::UninstallReason reason) {
141 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) 144 if (!ExtensionSystem::Get(profile_)->ready().is_signaled())
142 return; 145 return;
143 if (extension && UsesManagedStorage(extension)) { 146 if (extension && UsesManagedStorage(extension)) {
144 schema_registry_->UnregisterComponent(policy::PolicyNamespace( 147 schema_registry_->UnregisterComponent(policy::PolicyNamespace(
145 policy::POLICY_DOMAIN_EXTENSIONS, extension->id())); 148 policy::POLICY_DOMAIN_EXTENSIONS, extension->id()));
146 } 149 }
147 } 150 }
148 151
149 void ManagedValueStoreCache::ExtensionTracker::OnExtensionsReady() { 152 void ManagedValueStoreCache::ExtensionTracker::OnExtensionsReady() {
150 // Load schemas for all installed extensions. 153 // Load schemas for all installed extensions.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 365
363 return store; 366 return store;
364 } 367 }
365 368
366 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { 369 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const {
367 // TODO(joaodasilva): move this check to a ValueStore method. 370 // TODO(joaodasilva): move this check to a ValueStore method.
368 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); 371 return base::DirectoryExists(base_path_.AppendASCII(extension_id));
369 } 372 }
370 373
371 } // namespace extensions 374 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/management/management_api.cc ('k') | chrome/browser/extensions/error_console/error_console.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698