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> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/prefs/pref_change_registrar.h" | 32 #include "chrome/browser/prefs/pref_change_registrar.h" |
33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
34 #include "content/browser/browser_thread.h" | 34 #include "content/browser/browser_thread.h" |
35 #include "content/common/notification_observer.h" | 35 #include "content/common/notification_observer.h" |
36 #include "content/common/notification_registrar.h" | 36 #include "content/common/notification_registrar.h" |
37 #include "content/common/property_bag.h" | 37 #include "content/common/property_bag.h" |
38 | 38 |
39 class ExtensionBrowserEventRouter; | 39 class ExtensionBrowserEventRouter; |
40 class ExtensionPreferenceEventRouter; | 40 class ExtensionPreferenceEventRouter; |
41 class ExtensionServiceBackend; | 41 class ExtensionServiceBackend; |
| 42 struct ExtensionSyncData; |
42 class ExtensionToolbarModel; | 43 class ExtensionToolbarModel; |
43 class ExtensionUpdater; | 44 class ExtensionUpdater; |
44 class GURL; | 45 class GURL; |
45 class PendingExtensionManager; | 46 class PendingExtensionManager; |
46 class Profile; | 47 class Profile; |
47 class Version; | 48 class Version; |
48 | 49 |
49 // This is an interface class to encapsulate the dependencies that | 50 // This is an interface class to encapsulate the dependencies that |
50 // various classes have on ExtensionService. This allows easy mocking. | 51 // various classes have on ExtensionService. This allows easy mocking. |
51 class ExtensionServiceInterface { | 52 class ExtensionServiceInterface { |
(...skipping 22 matching lines...) Expand all Loading... |
74 const std::vector<std::string>& blacklist) = 0; | 75 const std::vector<std::string>& blacklist) = 0; |
75 virtual void CheckAdminBlacklist() = 0; | 76 virtual void CheckAdminBlacklist() = 0; |
76 virtual bool HasInstalledExtensions() = 0; | 77 virtual bool HasInstalledExtensions() = 0; |
77 | 78 |
78 virtual bool IsIncognitoEnabled(const std::string& extension_id) const = 0; | 79 virtual bool IsIncognitoEnabled(const std::string& extension_id) const = 0; |
79 virtual void SetIsIncognitoEnabled(const std::string& extension_id, | 80 virtual void SetIsIncognitoEnabled(const std::string& extension_id, |
80 bool enabled) = 0; | 81 bool enabled) = 0; |
81 | 82 |
82 // Safe to call multiple times in a row. | 83 // Safe to call multiple times in a row. |
83 // | 84 // |
84 // TODO(akalin): Remove this method (and others) once we add | 85 // TODO(akalin): Remove this method (and others) once we refactor |
85 // ProcessSyncData(). | 86 // themes sync to not use it directly. |
86 virtual void CheckForUpdatesSoon() = 0; | 87 virtual void CheckForUpdatesSoon() = 0; |
| 88 |
| 89 // Take any actions required to make the local state of the |
| 90 // extension match the state in |extension_sync_data| (including |
| 91 // installing/uninstalling the extension). |
| 92 // |
| 93 // TODO(akalin): We'll eventually need a separate method for app |
| 94 // sync. See http://crbug.com/58077 and http://crbug.com/61447. |
| 95 virtual void ProcessSyncData( |
| 96 const ExtensionSyncData& extension_sync_data, |
| 97 PendingExtensionInfo::ShouldAllowInstallPredicate |
| 98 should_allow_install) = 0; |
| 99 |
| 100 // TODO(akalin): Add a method like: |
| 101 // |
| 102 // virtual void |
| 103 // GetInitialSyncData(bool (*filter)(Extension), |
| 104 // map<string, ExtensionSyncData>* out) const; |
| 105 // |
| 106 // which would fill |out| with sync data for the extensions that |
| 107 // match |filter|. Sync would use this for the initial syncing |
| 108 // step. |
87 }; | 109 }; |
88 | 110 |
89 // Manages installed and running Chromium extensions. | 111 // Manages installed and running Chromium extensions. |
90 class ExtensionService | 112 class ExtensionService |
91 : public base::RefCountedThreadSafe<ExtensionService, | 113 : public base::RefCountedThreadSafe<ExtensionService, |
92 BrowserThread::DeleteOnUIThread>, | 114 BrowserThread::DeleteOnUIThread>, |
93 public ExtensionServiceInterface, | 115 public ExtensionServiceInterface, |
94 public ExternalExtensionProviderInterface::VisitorInterface, | 116 public ExternalExtensionProviderInterface::VisitorInterface, |
95 public NotificationObserver { | 117 public NotificationObserver { |
96 public: | 118 public: |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 virtual void UpdateExtensionBlacklist( | 360 virtual void UpdateExtensionBlacklist( |
339 const std::vector<std::string>& blacklist); | 361 const std::vector<std::string>& blacklist); |
340 | 362 |
341 // Go through each extension and unload those that the network admin has | 363 // Go through each extension and unload those that the network admin has |
342 // put on the blacklist (not to be confused with the Google managed blacklist | 364 // put on the blacklist (not to be confused with the Google managed blacklist |
343 // set of extensions. | 365 // set of extensions. |
344 virtual void CheckAdminBlacklist(); | 366 virtual void CheckAdminBlacklist(); |
345 | 367 |
346 virtual void CheckForUpdatesSoon(); | 368 virtual void CheckForUpdatesSoon(); |
347 | 369 |
| 370 virtual void ProcessSyncData( |
| 371 const ExtensionSyncData& extension_sync_data, |
| 372 PendingExtensionInfo::ShouldAllowInstallPredicate |
| 373 should_allow_install); |
| 374 |
348 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } | 375 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } |
349 bool extensions_enabled() { return extensions_enabled_; } | 376 bool extensions_enabled() { return extensions_enabled_; } |
350 | 377 |
351 void set_show_extensions_prompts(bool enabled) { | 378 void set_show_extensions_prompts(bool enabled) { |
352 show_extensions_prompts_ = enabled; | 379 show_extensions_prompts_ = enabled; |
353 } | 380 } |
354 | 381 |
355 bool show_extensions_prompts() { | 382 bool show_extensions_prompts() { |
356 return show_extensions_prompts_; | 383 return show_extensions_prompts_; |
357 } | 384 } |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 bool external_extension_url_added_; | 608 bool external_extension_url_added_; |
582 | 609 |
583 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 610 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
584 InstallAppsWithUnlimtedStorage); | 611 InstallAppsWithUnlimtedStorage); |
585 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 612 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
586 InstallAppsAndCheckStorageProtection); | 613 InstallAppsAndCheckStorageProtection); |
587 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 614 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
588 }; | 615 }; |
589 | 616 |
590 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 617 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |