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