| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // TODO(aa): Remove |external_uninstall| -- this information should be passed | 266 // TODO(aa): Remove |external_uninstall| -- this information should be passed |
| 267 // to ExtensionPrefs some other way. | 267 // to ExtensionPrefs some other way. |
| 268 void UninstallExtension(const std::string& extension_id, | 268 void UninstallExtension(const std::string& extension_id, |
| 269 bool external_uninstall); | 269 bool external_uninstall); |
| 270 | 270 |
| 271 // Enable or disable an extension. No action if the extension is already | 271 // Enable or disable an extension. No action if the extension is already |
| 272 // enabled/disabled. | 272 // enabled/disabled. |
| 273 void EnableExtension(const std::string& extension_id); | 273 void EnableExtension(const std::string& extension_id); |
| 274 void DisableExtension(const std::string& extension_id); | 274 void DisableExtension(const std::string& extension_id); |
| 275 | 275 |
| 276 // Updates the |extension|'s granted permissions lists to include all |
| 277 // permissions in the |extension|'s manifest. |
| 278 void GrantPermissions(const Extension* extension); |
| 279 |
| 280 // Updates the |extension|'s granted permissions lists to include all |
| 281 // permissions in the |extension|'s manifest and re-enables the |
| 282 // extension. |
| 283 void GrantPermissionsAndEnableExtension(const Extension* extension); |
| 284 |
| 276 // Load the extension from the directory |extension_path|. | 285 // Load the extension from the directory |extension_path|. |
| 277 void LoadExtension(const FilePath& extension_path); | 286 void LoadExtension(const FilePath& extension_path); |
| 278 | 287 |
| 279 // Load any component extensions. | 288 // Load any component extensions. |
| 280 void LoadComponentExtensions(); | 289 void LoadComponentExtensions(); |
| 281 | 290 |
| 282 // Load all known extensions (used by startup and testing code). | 291 // Load all known extensions (used by startup and testing code). |
| 283 void LoadAllExtensions(); | 292 void LoadAllExtensions(); |
| 284 | 293 |
| 285 // Continues loading all know extensions. It can be called from | 294 // Continues loading all know extensions. It can be called from |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void ClearProvidersForTesting(); | 349 void ClearProvidersForTesting(); |
| 341 | 350 |
| 342 // Sets an ExternalExtensionProvider for the service to use during testing. | 351 // Sets an ExternalExtensionProvider for the service to use during testing. |
| 343 // Takes ownership of |test_provider|. | 352 // Takes ownership of |test_provider|. |
| 344 void AddProviderForTesting(ExternalExtensionProvider* test_provider); | 353 void AddProviderForTesting(ExternalExtensionProvider* test_provider); |
| 345 | 354 |
| 346 // Called when the initial extensions load has completed. | 355 // Called when the initial extensions load has completed. |
| 347 virtual void OnLoadedInstalledExtensions(); | 356 virtual void OnLoadedInstalledExtensions(); |
| 348 | 357 |
| 349 // Called when an extension has been loaded. | 358 // Called when an extension has been loaded. |
| 350 void OnExtensionLoaded(const Extension* extension, | 359 void OnExtensionLoaded(const Extension* extension); |
| 351 bool allow_privilege_increase); | |
| 352 | 360 |
| 353 // Called by the backend when an extension has been installed. | 361 // Called by the backend when an extension has been installed. |
| 354 void OnExtensionInstalled(const Extension* extension, | 362 void OnExtensionInstalled(const Extension* extension); |
| 355 bool allow_privilege_increase); | |
| 356 | 363 |
| 357 // Called by the backend when an external extension is found. | 364 // Called by the backend when an external extension is found. |
| 358 void OnExternalExtensionFileFound(const std::string& id, | 365 void OnExternalExtensionFileFound(const std::string& id, |
| 359 const std::string& version, | 366 const std::string& version, |
| 360 const FilePath& path, | 367 const FilePath& path, |
| 361 Extension::Location location); | 368 Extension::Location location); |
| 362 | 369 |
| 370 // Checks if the privileges requested by |extension| have increased, and if |
| 371 // so, disables the extension and prompts the user to approve the change. |
| 372 void DisableIfPrivilegeIncrease(const Extension* extension); |
| 373 |
| 363 // Go through each extensions in pref, unload blacklisted extensions | 374 // Go through each extensions in pref, unload blacklisted extensions |
| 364 // and update the blacklist state in pref. | 375 // and update the blacklist state in pref. |
| 365 virtual void UpdateExtensionBlacklist( | 376 virtual void UpdateExtensionBlacklist( |
| 366 const std::vector<std::string>& blacklist); | 377 const std::vector<std::string>& blacklist); |
| 367 | 378 |
| 368 // Go through each extension and unload those that the network admin has | 379 // Go through each extension and unload those that the network admin has |
| 369 // put on the blacklist (not to be confused with the Google managed blacklist | 380 // put on the blacklist (not to be confused with the Google managed blacklist |
| 370 // set of extensions. | 381 // set of extensions. |
| 371 virtual void CheckAdminBlacklist(); | 382 virtual void CheckAdminBlacklist(); |
| 372 | 383 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 591 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 581 UpdatePendingExtensionAlreadyInstalled); | 592 UpdatePendingExtensionAlreadyInstalled); |
| 582 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 593 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 583 InstallAppsWithUnlimtedStorage); | 594 InstallAppsWithUnlimtedStorage); |
| 584 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 595 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 585 InstallAppsAndCheckStorageProtection); | 596 InstallAppsAndCheckStorageProtection); |
| 586 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); | 597 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); |
| 587 }; | 598 }; |
| 588 | 599 |
| 589 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 600 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |