| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <list> | 8 #include <list> |
| 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/compiler_specific.h" | 14 #include "base/compiler_specific.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/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/prefs/public/pref_change_registrar.h" | 19 #include "base/prefs/public/pref_change_registrar.h" |
| 20 #include "base/prefs/public/pref_observer.h" |
| 20 #include "base/string16.h" | 21 #include "base/string16.h" |
| 21 #include "chrome/browser/extensions/app_shortcut_manager.h" | 22 #include "chrome/browser/extensions/app_shortcut_manager.h" |
| 22 #include "chrome/browser/extensions/app_sync_bundle.h" | 23 #include "chrome/browser/extensions/app_sync_bundle.h" |
| 23 #include "chrome/browser/extensions/extension_icon_manager.h" | 24 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 24 #include "chrome/browser/extensions/extension_prefs.h" | 25 #include "chrome/browser/extensions/extension_prefs.h" |
| 25 #include "chrome/browser/extensions/extension_process_manager.h" | 26 #include "chrome/browser/extensions/extension_process_manager.h" |
| 26 #include "chrome/browser/extensions/extension_sync_bundle.h" | 27 #include "chrome/browser/extensions/extension_sync_bundle.h" |
| 27 #include "chrome/browser/extensions/extension_toolbar_model.h" | 28 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 28 #include "chrome/browser/extensions/extension_warning_set.h" | 29 #include "chrome/browser/extensions/extension_warning_set.h" |
| 29 #include "chrome/browser/extensions/extensions_quota_service.h" | 30 #include "chrome/browser/extensions/extensions_quota_service.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 virtual void SyncExtensionChangeIfNeeded( | 134 virtual void SyncExtensionChangeIfNeeded( |
| 134 const extensions::Extension& extension) = 0; | 135 const extensions::Extension& extension) = 0; |
| 135 | 136 |
| 136 virtual bool is_ready() = 0; | 137 virtual bool is_ready() = 0; |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 // Manages installed and running Chromium extensions. | 140 // Manages installed and running Chromium extensions. |
| 140 class ExtensionService | 141 class ExtensionService |
| 141 : public ExtensionServiceInterface, | 142 : public ExtensionServiceInterface, |
| 142 public extensions::ExternalProviderInterface::VisitorInterface, | 143 public extensions::ExternalProviderInterface::VisitorInterface, |
| 143 public content::NotificationObserver { | 144 public content::NotificationObserver, |
| 145 public PrefObserver { |
| 144 public: | 146 public: |
| 145 // The name of the directory inside the profile where extensions are | 147 // The name of the directory inside the profile where extensions are |
| 146 // installed to. | 148 // installed to. |
| 147 static const char kInstallDirectoryName[]; | 149 static const char kInstallDirectoryName[]; |
| 148 | 150 |
| 149 // If auto-updates are turned on, default to running every 5 hours. | 151 // If auto-updates are turned on, default to running every 5 hours. |
| 150 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; | 152 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; |
| 151 | 153 |
| 152 // The name of the directory inside the profile where per-app local settings | 154 // The name of the directory inside the profile where per-app local settings |
| 153 // are stored. | 155 // are stored. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 616 |
| 615 // Marks alertable extensions as acknowledged, after the user presses the | 617 // Marks alertable extensions as acknowledged, after the user presses the |
| 616 // accept button. | 618 // accept button. |
| 617 void HandleExtensionAlertAccept(); | 619 void HandleExtensionAlertAccept(); |
| 618 | 620 |
| 619 // content::NotificationObserver | 621 // content::NotificationObserver |
| 620 virtual void Observe(int type, | 622 virtual void Observe(int type, |
| 621 const content::NotificationSource& source, | 623 const content::NotificationSource& source, |
| 622 const content::NotificationDetails& details) OVERRIDE; | 624 const content::NotificationDetails& details) OVERRIDE; |
| 623 | 625 |
| 626 // PrefObserver |
| 627 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 628 const std::string& pref_name) OVERRIDE; |
| 629 |
| 624 // Whether there are any apps installed. Component apps are not included. | 630 // Whether there are any apps installed. Component apps are not included. |
| 625 bool HasApps() const; | 631 bool HasApps() const; |
| 626 | 632 |
| 627 // Gets the set of loaded app ids. Component apps are not included. | 633 // Gets the set of loaded app ids. Component apps are not included. |
| 628 extensions::ExtensionIdSet GetAppIds() const; | 634 extensions::ExtensionIdSet GetAppIds() const; |
| 629 | 635 |
| 630 // Record a histogram using the PermissionMessage enum values for each | 636 // Record a histogram using the PermissionMessage enum values for each |
| 631 // permission in |e|. | 637 // permission in |e|. |
| 632 // NOTE: If this is ever called with high frequency, the implementation may | 638 // NOTE: If this is ever called with high frequency, the implementation may |
| 633 // need to be made more efficient. | 639 // need to be made more efficient. |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 #endif | 952 #endif |
| 947 | 953 |
| 948 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 954 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 949 InstallAppsWithUnlimtedStorage); | 955 InstallAppsWithUnlimtedStorage); |
| 950 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 956 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 951 InstallAppsAndCheckStorageProtection); | 957 InstallAppsAndCheckStorageProtection); |
| 952 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 958 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 953 }; | 959 }; |
| 954 | 960 |
| 955 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 961 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |