| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MANAGEMENT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/prefs/pref_change_registrar.h" | 16 #include "base/prefs/pref_change_registrar.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 18 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 19 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
| 20 #include "extensions/browser/management_policy.h" | 20 #include "extensions/browser/management_policy.h" |
| 21 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 22 #include "extensions/common/manifest.h" | 22 #include "extensions/common/manifest.h" |
| 23 #include "extensions/common/url_pattern_set.h" | 23 #include "extensions/common/url_pattern_set.h" |
| 24 | 24 |
| 25 class GURL; |
| 25 class PrefService; | 26 class PrefService; |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| 28 class BrowserContext; | 29 class BrowserContext; |
| 29 } // namespace content | 30 } // namespace content |
| 30 | 31 |
| 31 namespace extensions { | 32 namespace extensions { |
| 32 | 33 |
| 33 // Tracks the management policies that affect extensions and provides interfaces | 34 // Tracks the management policies that affect extensions and provides interfaces |
| 34 // for observing and obtaining the global settings for all extensions, as well | 35 // for observing and obtaining the global settings for all extensions, as well |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // from the command line, or when loaded as an unpacked extension). | 111 // from the command line, or when loaded as an unpacked extension). |
| 111 bool BlacklistedByDefault(); | 112 bool BlacklistedByDefault(); |
| 112 | 113 |
| 113 // Returns the force install list, in format specified by | 114 // Returns the force install list, in format specified by |
| 114 // ExternalPolicyLoader::AddExtension(). | 115 // ExternalPolicyLoader::AddExtension(). |
| 115 scoped_ptr<base::DictionaryValue> GetForceInstallList() const; | 116 scoped_ptr<base::DictionaryValue> GetForceInstallList() const; |
| 116 | 117 |
| 117 // Returns if an extension with id |id| is allowed to install or not. | 118 // Returns if an extension with id |id| is allowed to install or not. |
| 118 bool IsInstallationAllowed(const ExtensionId& id) const; | 119 bool IsInstallationAllowed(const ExtensionId& id) const; |
| 119 | 120 |
| 121 // Returns true if an extension download should be allowed to proceed. |
| 122 bool IsOffstoreInstallAllowed(const GURL& url, const GURL& referrer_url); |
| 123 |
| 120 // Helper function to read |settings_by_id_| with |id| as key. Returns a | 124 // Helper function to read |settings_by_id_| with |id| as key. Returns a |
| 121 // constant reference to default settings if |id| does not exist. | 125 // constant reference to default settings if |id| does not exist. |
| 122 const IndividualSettings& ReadById(const ExtensionId& id) const; | 126 const IndividualSettings& ReadById(const ExtensionId& id) const; |
| 123 | 127 |
| 124 // Returns a constant reference to |global_settings_|. | 128 // Returns a constant reference to |global_settings_|. |
| 125 const GlobalSettings& ReadGlobalSettings() const; | 129 const GlobalSettings& ReadGlobalSettings() const; |
| 126 | 130 |
| 127 private: | 131 private: |
| 128 // Load all extension management preferences from |pref_service|, and | 132 // Load all extension management preferences from |pref_service|, and |
| 129 // refresh the settings. | 133 // refresh the settings. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 content::BrowserContext* context) const OVERRIDE; | 193 content::BrowserContext* context) const OVERRIDE; |
| 190 virtual content::BrowserContext* GetBrowserContextToUse( | 194 virtual content::BrowserContext* GetBrowserContextToUse( |
| 191 content::BrowserContext* context) const OVERRIDE; | 195 content::BrowserContext* context) const OVERRIDE; |
| 192 | 196 |
| 193 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementFactory); | 197 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementFactory); |
| 194 }; | 198 }; |
| 195 | 199 |
| 196 } // namespace extensions | 200 } // namespace extensions |
| 197 | 201 |
| 198 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ | 202 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_H_ |
| OLD | NEW |