| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 // Determine if the downloaded extension came from the theme mini-gallery, | 142 // Determine if the downloaded extension came from the theme mini-gallery, |
| 143 // Used to test if we need to show the "Loading" dialog for themes. | 143 // Used to test if we need to show the "Loading" dialog for themes. |
| 144 static bool IsDownloadFromMiniGallery(const GURL& download_url); | 144 static bool IsDownloadFromMiniGallery(const GURL& download_url); |
| 145 | 145 |
| 146 // Attempts to uninstall an extension from a given ExtensionService. Returns | 146 // Attempts to uninstall an extension from a given ExtensionService. Returns |
| 147 // true iff the target extension exists. | 147 // true iff the target extension exists. |
| 148 static bool UninstallExtensionHelper(ExtensionsService* extensions_service, | 148 static bool UninstallExtensionHelper(ExtensionsService* extensions_service, |
| 149 const std::string& extension_id); | 149 const std::string& extension_id); |
| 150 | 150 |
| 151 // Constructor stores pointers to |profile| and |extension_prefs| but |
| 152 // ownership remains at caller. |
| 151 ExtensionsService(Profile* profile, | 153 ExtensionsService(Profile* profile, |
| 152 const CommandLine* command_line, | 154 const CommandLine* command_line, |
| 153 const FilePath& install_directory, | 155 const FilePath& install_directory, |
| 156 ExtensionPrefs* extension_prefs, |
| 154 bool autoupdate_enabled); | 157 bool autoupdate_enabled); |
| 155 | 158 |
| 156 // Gets the list of currently installed extensions. | 159 // Gets the list of currently installed extensions. |
| 157 virtual const ExtensionList* extensions() const { return &extensions_; } | 160 virtual const ExtensionList* extensions() const { return &extensions_; } |
| 158 virtual const ExtensionList* disabled_extensions() const { | 161 virtual const ExtensionList* disabled_extensions() const { |
| 159 return &disabled_extensions_; | 162 return &disabled_extensions_; |
| 160 } | 163 } |
| 161 | 164 |
| 162 // Gets the set of pending extensions. | 165 // Gets the set of pending extensions. |
| 163 virtual const PendingExtensionMap& pending_extensions() const { | 166 virtual const PendingExtensionMap& pending_extensions() const { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 bool show_extensions_prompts() { | 398 bool show_extensions_prompts() { |
| 396 return show_extensions_prompts_; | 399 return show_extensions_prompts_; |
| 397 } | 400 } |
| 398 | 401 |
| 399 Profile* profile() { return profile_; } | 402 Profile* profile() { return profile_; } |
| 400 | 403 |
| 401 // Profile calls this when it is being destroyed so that we know not to call | 404 // Profile calls this when it is being destroyed so that we know not to call |
| 402 // it. | 405 // it. |
| 403 void DestroyingProfile(); | 406 void DestroyingProfile(); |
| 404 | 407 |
| 405 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } | 408 ExtensionPrefs* extension_prefs() { return extension_prefs_; } |
| 406 | 409 |
| 407 // Whether the extension service is ready. | 410 // Whether the extension service is ready. |
| 408 // TODO(skerner): Get rid of this method. crbug.com/63756 | 411 // TODO(skerner): Get rid of this method. crbug.com/63756 |
| 409 bool is_ready() { return ready_; } | 412 bool is_ready() { return ready_; } |
| 410 | 413 |
| 411 // Note that this may return NULL if autoupdate is not turned on. | 414 // Note that this may return NULL if autoupdate is not turned on. |
| 412 ExtensionUpdater* updater() { return updater_.get(); } | 415 ExtensionUpdater* updater() { return updater_.get(); } |
| 413 | 416 |
| 414 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } | 417 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } |
| 415 | 418 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 501 |
| 499 // Helper methods to configure the storage services accordingly. | 502 // Helper methods to configure the storage services accordingly. |
| 500 void GrantProtectedStorage(const Extension* extension); | 503 void GrantProtectedStorage(const Extension* extension); |
| 501 void RevokeProtectedStorage(const Extension* extension); | 504 void RevokeProtectedStorage(const Extension* extension); |
| 502 void GrantUnlimitedStorage(const Extension* extension); | 505 void GrantUnlimitedStorage(const Extension* extension); |
| 503 void RevokeUnlimitedStorage(const Extension* extension); | 506 void RevokeUnlimitedStorage(const Extension* extension); |
| 504 | 507 |
| 505 // The profile this ExtensionsService is part of. | 508 // The profile this ExtensionsService is part of. |
| 506 Profile* profile_; | 509 Profile* profile_; |
| 507 | 510 |
| 508 // Preferences for the owning profile. | 511 // Preferences for the owning profile (weak reference). |
| 509 scoped_ptr<ExtensionPrefs> extension_prefs_; | 512 ExtensionPrefs* extension_prefs_; |
| 510 | 513 |
| 511 // The current list of installed extensions. | 514 // The current list of installed extensions. |
| 512 ExtensionList extensions_; | 515 ExtensionList extensions_; |
| 513 | 516 |
| 514 // The list of installed extensions that have been disabled. | 517 // The list of installed extensions that have been disabled. |
| 515 ExtensionList disabled_extensions_; | 518 ExtensionList disabled_extensions_; |
| 516 | 519 |
| 517 // The set of pending extensions. | 520 // The set of pending extensions. |
| 518 PendingExtensionMap pending_extensions_; | 521 PendingExtensionMap pending_extensions_; |
| 519 | 522 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 601 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 599 UpdatePendingExtensionAlreadyInstalled); | 602 UpdatePendingExtensionAlreadyInstalled); |
| 600 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 603 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 601 InstallAppsWithUnlimtedStorage); | 604 InstallAppsWithUnlimtedStorage); |
| 602 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, | 605 FRIEND_TEST_ALL_PREFIXES(ExtensionsServiceTest, |
| 603 InstallAppsAndCheckStorageProtection); | 606 InstallAppsAndCheckStorageProtection); |
| 604 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); | 607 DISALLOW_COPY_AND_ASSIGN(ExtensionsService); |
| 605 }; | 608 }; |
| 606 | 609 |
| 607 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 610 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |