| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 // Called by the backend when an extension has been installed. | 358 // Called by the backend when an extension has been installed. |
| 350 void OnExtensionInstalled(const Extension* extension, | 359 void OnExtensionInstalled(const Extension* extension, |
| 351 bool allow_privilege_increase); | 360 bool allow_privilege_increase); |
| 352 | 361 |
| 353 // Called by the backend when an external extension is found. | 362 // Called by the backend when an external extension is found. |
| 354 void OnExternalExtensionFileFound(const std::string& id, | 363 void OnExternalExtensionFileFound(const std::string& id, |
| 355 const std::string& version, | 364 const std::string& version, |
| 356 const FilePath& path, | 365 const FilePath& path, |
| 357 Extension::Location location); | 366 Extension::Location location); |
| 358 | 367 |
| 368 // Checks if the privileges requested by |extension| have increased, and if |
| 369 // so, disables the extension and prompts the user to approve the change. |
| 370 // |allow_privilege_increase| should be set to true for extension types that |
| 371 // are allowed to change privileges without user approval. |
| 372 void DisableIfPrivilegeIncrease(const Extension* extension, |
| 373 bool allow_privilege_increase); |
| 374 |
| 359 // Go through each extensions in pref, unload blacklisted extensions | 375 // Go through each extensions in pref, unload blacklisted extensions |
| 360 // and update the blacklist state in pref. | 376 // and update the blacklist state in pref. |
| 361 virtual void UpdateExtensionBlacklist( | 377 virtual void UpdateExtensionBlacklist( |
| 362 const std::vector<std::string>& blacklist); | 378 const std::vector<std::string>& blacklist); |
| 363 | 379 |
| 364 // Go through each extension and unload those that the network admin has | 380 // Go through each extension and unload those that the network admin has |
| 365 // put on the blacklist (not to be confused with the Google managed blacklist | 381 // put on the blacklist (not to be confused with the Google managed blacklist |
| 366 // set of extensions. | 382 // set of extensions. |
| 367 virtual void CheckAdminBlacklist(); | 383 virtual void CheckAdminBlacklist(); |
| 368 | 384 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 592 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 577 UpdatePendingExtensionAlreadyInstalled); | 593 UpdatePendingExtensionAlreadyInstalled); |
| 578 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 594 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 579 InstallAppsWithUnlimtedStorage); | 595 InstallAppsWithUnlimtedStorage); |
| 580 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 596 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 581 InstallAppsAndCheckStorageProtection); | 597 InstallAppsAndCheckStorageProtection); |
| 582 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); | 598 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); |
| 583 }; | 599 }; |
| 584 | 600 |
| 585 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 601 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |