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

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

Issue 8477005: Add policies to specify an enterprise web store. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests for ComponentLoader. Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 virtual void UpdateExtensionBlacklist( 107 virtual void UpdateExtensionBlacklist(
108 const std::vector<std::string>& blacklist) = 0; 108 const std::vector<std::string>& blacklist) = 0;
109 virtual void CheckAdminBlacklist() = 0; 109 virtual void CheckAdminBlacklist() = 0;
110 110
111 // Safe to call multiple times in a row. 111 // Safe to call multiple times in a row.
112 // 112 //
113 // TODO(akalin): Remove this method (and others) once we refactor 113 // TODO(akalin): Remove this method (and others) once we refactor
114 // themes sync to not use it directly. 114 // themes sync to not use it directly.
115 virtual void CheckForUpdatesSoon() = 0; 115 virtual void CheckForUpdatesSoon() = 0;
116
117 virtual void AddExtension(const Extension* extension) = 0;
118
119 virtual void UnloadExtension(
120 const std::string& extension_id,
121 extension_misc::UnloadedExtensionReason reason) = 0;
122
123 virtual bool is_ready() = 0;
116 }; 124 };
117 125
118 // Manages installed and running Chromium extensions. 126 // Manages installed and running Chromium extensions.
119 class ExtensionService 127 class ExtensionService
120 : public ExtensionServiceInterface, 128 : public ExtensionServiceInterface,
121 public ExternalExtensionProviderInterface::VisitorInterface, 129 public ExternalExtensionProviderInterface::VisitorInterface,
122 public base::SupportsWeakPtr<ExtensionService>, 130 public base::SupportsWeakPtr<ExtensionService>,
123 public content::NotificationObserver { 131 public content::NotificationObserver {
124 public: 132 public:
125 using base::SupportsWeakPtr<ExtensionService>::AsWeakPtr; 133 using base::SupportsWeakPtr<ExtensionService>::AsWeakPtr;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 void GrantPermissionsAndEnableExtension(const Extension* extension); 310 void GrantPermissionsAndEnableExtension(const Extension* extension);
303 311
304 // Sets the |extension|'s active permissions to |permissions|. 312 // Sets the |extension|'s active permissions to |permissions|.
305 void UpdateActivePermissions(const Extension* extension, 313 void UpdateActivePermissions(const Extension* extension,
306 const ExtensionPermissionSet* permissions); 314 const ExtensionPermissionSet* permissions);
307 315
308 // Check for updates (or potentially new extensions from external providers) 316 // Check for updates (or potentially new extensions from external providers)
309 void CheckForExternalUpdates(); 317 void CheckForExternalUpdates();
310 318
311 // Unload the specified extension. 319 // Unload the specified extension.
312 void UnloadExtension(const std::string& extension_id, 320 virtual void UnloadExtension(
313 extension_misc::UnloadedExtensionReason reason); 321 const std::string& extension_id,
322 extension_misc::UnloadedExtensionReason reason);
314 323
315 // Unload all extensions. This is currently only called on shutdown, and 324 // Unload all extensions. This is currently only called on shutdown, and
316 // does not send notifications. 325 // does not send notifications.
317 void UnloadAllExtensions(); 326 void UnloadAllExtensions();
318 327
319 // Called only by testing. 328 // Called only by testing.
320 void ReloadExtensions(); 329 void ReloadExtensions();
321 330
322 // Scan the extension directory and clean up the cruft. 331 // Scan the extension directory and clean up the cruft.
323 void GarbageCollectExtensions(); 332 void GarbageCollectExtensions();
(...skipping 26 matching lines...) Expand all
350 // Returns the icon to display in the omnibox popup window for the given 359 // Returns the icon to display in the omnibox popup window for the given
351 // extension. 360 // extension.
352 const SkBitmap& GetOmniboxPopupIcon(const std::string& extension_id); 361 const SkBitmap& GetOmniboxPopupIcon(const std::string& extension_id);
353 362
354 // Called when the initial extensions load has completed. 363 // Called when the initial extensions load has completed.
355 virtual void OnLoadedInstalledExtensions(); 364 virtual void OnLoadedInstalledExtensions();
356 365
357 // Adds |extension| to this ExtensionService and notifies observers than an 366 // Adds |extension| to this ExtensionService and notifies observers than an
358 // extension has been loaded. Called by the backend after an extension has 367 // extension has been loaded. Called by the backend after an extension has
359 // been loaded from a file and installed. 368 // been loaded from a file and installed.
360 void AddExtension(const Extension* extension); 369 virtual void AddExtension(const Extension* extension);
361 370
362 // Called by the backend when an extension has been installed. 371 // Called by the backend when an extension has been installed.
363 void OnExtensionInstalled( 372 void OnExtensionInstalled(
364 const Extension* extension, bool from_webstore, int page_index); 373 const Extension* extension, bool from_webstore, int page_index);
365 374
366 // Initializes the |extension|'s active permission set and disables the 375 // Initializes the |extension|'s active permission set and disables the
367 // extension if the privilege level has increased (e.g., due to an upgrade). 376 // extension if the privilege level has increased (e.g., due to an upgrade).
368 void InitializePermissions(const Extension* extension); 377 void InitializePermissions(const Extension* extension);
369 378
370 // Go through each extensions in pref, unload blacklisted extensions 379 // Go through each extensions in pref, unload blacklisted extensions
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 414
406 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, 415 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const,
407 // ExtensionPrefs* mutable_extension_prefs(). 416 // ExtensionPrefs* mutable_extension_prefs().
408 ExtensionPrefs* extension_prefs(); 417 ExtensionPrefs* extension_prefs();
409 418
410 ExtensionSettingsFrontend* extension_settings_frontend(); 419 ExtensionSettingsFrontend* extension_settings_frontend();
411 420
412 ExtensionContentSettingsStore* GetExtensionContentSettingsStore(); 421 ExtensionContentSettingsStore* GetExtensionContentSettingsStore();
413 422
414 // Whether the extension service is ready. 423 // Whether the extension service is ready.
415 bool is_ready() { return ready_; } 424 virtual bool is_ready() { return ready_; }
416 425
417 extensions::ComponentLoader* component_loader() { 426 extensions::ComponentLoader* component_loader() {
418 return component_loader_.get(); 427 return component_loader_.get();
419 } 428 }
420 429
421 // Note that this may return NULL if autoupdate is not turned on. 430 // Note that this may return NULL if autoupdate is not turned on.
422 ExtensionUpdater* updater(); 431 ExtensionUpdater* updater();
423 432
424 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } 433 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; }
425 434
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 ExtensionWarningSet extension_warnings_; 798 ExtensionWarningSet extension_warnings_;
790 799
791 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 800 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
792 InstallAppsWithUnlimtedStorage); 801 InstallAppsWithUnlimtedStorage);
793 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 802 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
794 InstallAppsAndCheckStorageProtection); 803 InstallAppsAndCheckStorageProtection);
795 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 804 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
796 }; 805 };
797 806
798 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 807 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698