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

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

Issue 125573002: Move ExtensionService::GetExtensionById() to ExtensionRegistry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, add test, get_extension_by_id Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void FinishVerifyAllExtensions(bool success); 222 void FinishVerifyAllExtensions(bool success);
223 223
224 // Called when the associated Profile is going to be destroyed. 224 // Called when the associated Profile is going to be destroyed.
225 void Shutdown(); 225 void Shutdown();
226 226
227 // Look up an extension by ID. Does not include terminated 227 // Look up an extension by ID. Does not include terminated
228 // extensions. 228 // extensions.
229 virtual const extensions::Extension* GetExtensionById( 229 virtual const extensions::Extension* GetExtensionById(
230 const std::string& id, bool include_disabled) const OVERRIDE; 230 const std::string& id, bool include_disabled) const OVERRIDE;
231 231
232 enum IncludeFlag {
233 INCLUDE_NONE = 0,
234 INCLUDE_ENABLED = 1 << 0,
235 INCLUDE_DISABLED = 1 << 1,
236 INCLUDE_TERMINATED = 1 << 2,
237 INCLUDE_BLACKLISTED = 1 << 3,
238 INCLUDE_EVERYTHING = (1 << 4) - 1,
239 };
240
241 // Look up an extension by ID, selecting which sets to look in:
242 // * extensions() --> INCLUDE_ENABLED
243 // * disabled_extensions() --> INCLUDE_DISABLED
244 // * terminated_extensions() --> INCLUDE_TERMINATED
245 // * blacklisted_extensions() --> INCLUDE_BLACKLISTED
246 const extensions::Extension* GetExtensionById(const std::string& id,
247 int include_mask) const;
248
249 // Returns the site of the given |extension_id|. Suitable for use with 232 // Returns the site of the given |extension_id|. Suitable for use with
250 // BrowserContext::GetStoragePartitionForSite(). 233 // BrowserContext::GetStoragePartitionForSite().
251 GURL GetSiteForExtensionId(const std::string& extension_id); 234 GURL GetSiteForExtensionId(const std::string& extension_id);
252 235
253 // Looks up a terminated (crashed) extension by ID. 236 // Looks up a terminated (crashed) extension by ID.
237 // DEPRECATED: Replace with:
238 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::TERMINATED).
254 const extensions::Extension* 239 const extensions::Extension*
255 GetTerminatedExtension(const std::string& id) const; 240 GetTerminatedExtension(const std::string& id) const;
256 241
257 // Looks up an extension by ID, regardless of whether it's enabled, 242 // Looks up an extension by ID, regardless of whether it's enabled,
258 // disabled, blacklisted, or terminated. 243 // disabled, blacklisted, or terminated.
244 // DEPRECATED: Replace with:
245 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING).
259 virtual const extensions::Extension* GetInstalledExtension( 246 virtual const extensions::Extension* GetInstalledExtension(
260 const std::string& id) const OVERRIDE; 247 const std::string& id) const OVERRIDE;
261 248
262 // Updates a currently-installed extension with the contents from 249 // Updates a currently-installed extension with the contents from
263 // |extension_path|. 250 // |extension_path|.
264 // TODO(aa): This method can be removed. ExtensionUpdater could use 251 // TODO(aa): This method can be removed. ExtensionUpdater could use
265 // CrxInstaller directly instead. 252 // CrxInstaller directly instead.
266 virtual bool UpdateExtension( 253 virtual bool UpdateExtension(
267 const std::string& id, 254 const std::string& id,
268 const base::FilePath& extension_path, 255 const base::FilePath& extension_path,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 void set_show_extensions_prompts(bool enabled) { 419 void set_show_extensions_prompts(bool enabled) {
433 show_extensions_prompts_ = enabled; 420 show_extensions_prompts_ = enabled;
434 } 421 }
435 422
436 bool show_extensions_prompts() { 423 bool show_extensions_prompts() {
437 return show_extensions_prompts_; 424 return show_extensions_prompts_;
438 } 425 }
439 426
440 Profile* profile(); 427 Profile* profile();
441 428
429 // Returns profile_ as a BrowserContext.
430 content::BrowserContext* GetBrowserContext() const;
431
442 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, 432 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const,
443 // ExtensionPrefs* mutable_extension_prefs(). 433 // ExtensionPrefs* mutable_extension_prefs().
444 extensions::ExtensionPrefs* extension_prefs(); 434 extensions::ExtensionPrefs* extension_prefs();
445 const extensions::ExtensionPrefs* extension_prefs() const; 435 const extensions::ExtensionPrefs* extension_prefs() const;
446 436
447 extensions::SettingsFrontend* settings_frontend(); 437 extensions::SettingsFrontend* settings_frontend();
448 438
449 void set_extension_sync_service( 439 void set_extension_sync_service(
450 ExtensionSyncService* extension_sync_service) { 440 ExtensionSyncService* extension_sync_service) {
451 extension_sync_service_ = extension_sync_service; 441 extension_sync_service_ = extension_sync_service;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 #endif 851 #endif
862 852
863 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 853 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
864 InstallAppsWithUnlimtedStorage); 854 InstallAppsWithUnlimtedStorage);
865 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 855 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
866 InstallAppsAndCheckStorageProtection); 856 InstallAppsAndCheckStorageProtection);
867 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 857 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
868 }; 858 };
869 859
870 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 860 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698