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

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

Issue 1497193002: Remove all the ephemeral apps code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests Created 5 years 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/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 : public ExtensionRegistryObserver { 68 : public ExtensionRegistryObserver {
69 public: 69 public:
70 explicit ExtensionTracker(Profile* profile); 70 explicit ExtensionTracker(Profile* profile);
71 ~ExtensionTracker() override {} 71 ~ExtensionTracker() override {}
72 72
73 private: 73 private:
74 // ExtensionRegistryObserver implementation. 74 // ExtensionRegistryObserver implementation.
75 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, 75 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
76 const Extension* extension, 76 const Extension* extension,
77 bool is_update, 77 bool is_update,
78 bool from_ephemeral,
79 const std::string& old_name) override; 78 const std::string& old_name) override;
80 void OnExtensionUninstalled(content::BrowserContext* browser_context, 79 void OnExtensionUninstalled(content::BrowserContext* browser_context,
81 const Extension* extension, 80 const Extension* extension,
82 extensions::UninstallReason reason) override; 81 extensions::UninstallReason reason) override;
83 82
84 // Handler for the signal from ExtensionSystem::ready(). 83 // Handler for the signal from ExtensionSystem::ready().
85 void OnExtensionsReady(); 84 void OnExtensionsReady();
86 85
87 // Starts a schema load for all extensions that use managed storage. 86 // Starts a schema load for all extensions that use managed storage.
88 void LoadSchemas(scoped_ptr<ExtensionSet> added); 87 void LoadSchemas(scoped_ptr<ExtensionSet> added);
(...skipping 26 matching lines...) Expand all
115 ExtensionSystem::Get(profile_)->ready().Post( 114 ExtensionSystem::Get(profile_)->ready().Post(
116 FROM_HERE, 115 FROM_HERE,
117 base::Bind(&ExtensionTracker::OnExtensionsReady, 116 base::Bind(&ExtensionTracker::OnExtensionsReady,
118 weak_factory_.GetWeakPtr())); 117 weak_factory_.GetWeakPtr()));
119 } 118 }
120 119
121 void ManagedValueStoreCache::ExtensionTracker::OnExtensionWillBeInstalled( 120 void ManagedValueStoreCache::ExtensionTracker::OnExtensionWillBeInstalled(
122 content::BrowserContext* browser_context, 121 content::BrowserContext* browser_context,
123 const Extension* extension, 122 const Extension* extension,
124 bool is_update, 123 bool is_update,
125 bool from_ephemeral,
126 const std::string& old_name) { 124 const std::string& old_name) {
127 // Some extensions are installed on the first run before the ExtensionSystem 125 // Some extensions are installed on the first run before the ExtensionSystem
128 // becomes ready. Wait until all of them are ready before registering the 126 // becomes ready. Wait until all of them are ready before registering the
129 // schemas of managed extensions, so that the policy loaders are reloaded at 127 // schemas of managed extensions, so that the policy loaders are reloaded at
130 // most once. 128 // most once.
131 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) 129 if (!ExtensionSystem::Get(profile_)->ready().is_signaled())
132 return; 130 return;
133 scoped_ptr<ExtensionSet> added(new ExtensionSet); 131 scoped_ptr<ExtensionSet> added(new ExtensionSet);
134 added->Insert(extension); 132 added->Insert(extension);
135 LoadSchemas(added.Pass()); 133 LoadSchemas(added.Pass());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 365
368 return store; 366 return store;
369 } 367 }
370 368
371 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { 369 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const {
372 // TODO(joaodasilva): move this check to a ValueStore method. 370 // TODO(joaodasilva): move this check to a ValueStore method.
373 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); 371 return base::DirectoryExists(base_path_.AppendASCII(extension_id));
374 } 372 }
375 373
376 } // namespace extensions 374 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698