| OLD | NEW |
| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/task.h" | 19 #include "base/task.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "base/tuple.h" | 21 #include "base/tuple.h" |
| 22 #include "chrome/browser/extensions/default_apps.h" | 22 #include "chrome/browser/extensions/apps_promo.h" |
| 23 #include "chrome/browser/extensions/extension_icon_manager.h" | 23 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 24 #include "chrome/browser/extensions/extension_menu_manager.h" | 24 #include "chrome/browser/extensions/extension_menu_manager.h" |
| 25 #include "chrome/browser/extensions/extension_prefs.h" | 25 #include "chrome/browser/extensions/extension_prefs.h" |
| 26 #include "chrome/browser/extensions/extension_process_manager.h" | 26 #include "chrome/browser/extensions/extension_process_manager.h" |
| 27 #include "chrome/browser/extensions/extension_toolbar_model.h" | 27 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 28 #include "chrome/browser/extensions/extensions_quota_service.h" | 28 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 29 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 29 #include "chrome/browser/extensions/external_extension_provider_interface.h" |
| 30 #include "chrome/browser/extensions/pending_extension_manager.h" | 30 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 31 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 31 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
| 32 #include "chrome/browser/prefs/pref_change_registrar.h" | 32 #include "chrome/browser/prefs/pref_change_registrar.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Registers an extension to be loaded as a component extension. | 160 // Registers an extension to be loaded as a component extension. |
| 161 void register_component_extension(const ComponentExtensionInfo& info) { | 161 void register_component_extension(const ComponentExtensionInfo& info) { |
| 162 component_extension_manifests_.push_back(info); | 162 component_extension_manifests_.push_back(info); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Returns true if any extensions are installed. | 165 // Returns true if any extensions are installed. |
| 166 virtual bool HasInstalledExtensions(); | 166 virtual bool HasInstalledExtensions(); |
| 167 | 167 |
| 168 const FilePath& install_directory() const { return install_directory_; } | 168 const FilePath& install_directory() const { return install_directory_; } |
| 169 | 169 |
| 170 DefaultApps* default_apps() { return &default_apps_; } | 170 AppsPromo* apps_promo() { return &apps_promo_; } |
| 171 | 171 |
| 172 // Whether this extension can run in an incognito window. | 172 // Whether this extension can run in an incognito window. |
| 173 virtual bool IsIncognitoEnabled(const std::string& extension_id) const; | 173 virtual bool IsIncognitoEnabled(const std::string& extension_id) const; |
| 174 virtual void SetIsIncognitoEnabled(const std::string& extension_id, | 174 virtual void SetIsIncognitoEnabled(const std::string& extension_id, |
| 175 bool enabled); | 175 bool enabled); |
| 176 | 176 |
| 177 // Returns true if the given extension can see events and data from another | 177 // Returns true if the given extension can see events and data from another |
| 178 // sub-profile (incognito to original profile, or vice versa). | 178 // sub-profile (incognito to original profile, or vice versa). |
| 179 bool CanCrossIncognito(const Extension* extension); | 179 bool CanCrossIncognito(const Extension* extension); |
| 180 | 180 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 ExtensionMenuManager menu_manager_; | 552 ExtensionMenuManager menu_manager_; |
| 553 | 553 |
| 554 // Keeps track of favicon-sized omnibox icons for extensions. | 554 // Keeps track of favicon-sized omnibox icons for extensions. |
| 555 ExtensionIconManager omnibox_icon_manager_; | 555 ExtensionIconManager omnibox_icon_manager_; |
| 556 ExtensionIconManager omnibox_popup_icon_manager_; | 556 ExtensionIconManager omnibox_popup_icon_manager_; |
| 557 | 557 |
| 558 // List of registered component extensions (see Extension::Location). | 558 // List of registered component extensions (see Extension::Location). |
| 559 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 559 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
| 560 RegisteredComponentExtensions component_extension_manifests_; | 560 RegisteredComponentExtensions component_extension_manifests_; |
| 561 | 561 |
| 562 // Manages the installation of default apps and the promotion of them in the | 562 // Manages the promotion of the web store. |
| 563 // app launcher. | 563 AppsPromo apps_promo_; |
| 564 DefaultApps default_apps_; | |
| 565 | 564 |
| 566 // Flag to make sure event routers are only initialized once. | 565 // Flag to make sure event routers are only initialized once. |
| 567 bool event_routers_initialized_; | 566 bool event_routers_initialized_; |
| 568 | 567 |
| 569 scoped_ptr<ExtensionBrowserEventRouter> browser_event_router_; | 568 scoped_ptr<ExtensionBrowserEventRouter> browser_event_router_; |
| 570 | 569 |
| 571 scoped_ptr<ExtensionPreferenceEventRouter> preference_event_router_; | 570 scoped_ptr<ExtensionPreferenceEventRouter> preference_event_router_; |
| 572 | 571 |
| 573 // A collection of external extension providers. Each provider reads | 572 // A collection of external extension providers. Each provider reads |
| 574 // a source of external extension information. Examples include the | 573 // a source of external extension information. Examples include the |
| 575 // windows registry and external_extensions.json. | 574 // windows registry and external_extensions.json. |
| 576 ProviderCollection external_extension_providers_; | 575 ProviderCollection external_extension_providers_; |
| 577 | 576 |
| 578 // Set to true by OnExternalExtensionUpdateUrlFound() when an external | 577 // Set to true by OnExternalExtensionUpdateUrlFound() when an external |
| 579 // extension URL is found. Used in CheckForExternalUpdates() to see | 578 // extension URL is found. Used in CheckForExternalUpdates() to see |
| 580 // if an update check is needed to install pending extensions. | 579 // if an update check is needed to install pending extensions. |
| 581 bool external_extension_url_added_; | 580 bool external_extension_url_added_; |
| 582 | 581 |
| 583 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 582 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 584 InstallAppsWithUnlimtedStorage); | 583 InstallAppsWithUnlimtedStorage); |
| 585 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 584 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 586 InstallAppsAndCheckStorageProtection); | 585 InstallAppsAndCheckStorageProtection); |
| 587 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 586 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 588 }; | 587 }; |
| 589 | 588 |
| 590 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 589 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |