Chromium Code Reviews| 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_PREFS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/extensions/extension_content_settings_store.h" | 16 #include "chrome/browser/extensions/extension_content_settings_store.h" |
| 17 #include "chrome/browser/extensions/extension_management_policy.h" | |
| 17 #include "chrome/browser/extensions/extension_prefs_scope.h" | 18 #include "chrome/browser/extensions/extension_prefs_scope.h" |
| 18 #include "chrome/browser/extensions/extension_scoped_prefs.h" | 19 #include "chrome/browser/extensions/extension_scoped_prefs.h" |
| 19 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/string_ordinal.h" | 21 #include "chrome/common/string_ordinal.h" |
| 21 | 22 |
| 22 class ExtensionPrefValueMap; | 23 class ExtensionPrefValueMap; |
| 23 class ExtensionSorting; | 24 class ExtensionSorting; |
| 24 class PrefService; | 25 class PrefService; |
| 25 class URLPatternSet; | 26 class URLPatternSet; |
| 26 | 27 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 38 // - per-extension preferences: | 39 // - per-extension preferences: |
| 39 // meta-preferences describing properties of the extension like | 40 // meta-preferences describing properties of the extension like |
| 40 // installation time, whether the extension is enabled, etc. | 41 // installation time, whether the extension is enabled, etc. |
| 41 // - extension controlled preferences: | 42 // - extension controlled preferences: |
| 42 // browser preferences that an extension controls. For example, an | 43 // browser preferences that an extension controls. For example, an |
| 43 // extension could use the proxy API to specify the browser's proxy | 44 // extension could use the proxy API to specify the browser's proxy |
| 44 // preference. Extension-controlled preferences are stored in | 45 // preference. Extension-controlled preferences are stored in |
| 45 // PrefValueStore::extension_prefs(), which this class populates and | 46 // PrefValueStore::extension_prefs(), which this class populates and |
| 46 // maintains as the underlying extensions change. | 47 // maintains as the underlying extensions change. |
| 47 class ExtensionPrefs : public ExtensionContentSettingsStore::Observer, | 48 class ExtensionPrefs : public ExtensionContentSettingsStore::Observer, |
| 49 public ExtensionManagementPolicy::Delegate, | |
| 48 public ExtensionScopedPrefs { | 50 public ExtensionScopedPrefs { |
| 49 public: | 51 public: |
| 50 // Key name for a preference that keeps track of per-extension settings. This | 52 // Key name for a preference that keeps track of per-extension settings. This |
| 51 // is a dictionary object read from the Preferences file, keyed off of | 53 // is a dictionary object read from the Preferences file, keyed off of |
| 52 // extension ids. | 54 // extension ids. |
| 53 static const char kExtensionsPref[]; | 55 static const char kExtensionsPref[]; |
| 54 | 56 |
| 55 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; | 57 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; |
| 56 | 58 |
| 57 // Vector containing identifiers for preferences. | 59 // Vector containing identifiers for preferences. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 | 197 |
| 196 // The oauth client id used for app notification setup, if any. | 198 // The oauth client id used for app notification setup, if any. |
| 197 std::string GetAppNotificationClientId(const std::string& extension_id) const; | 199 std::string GetAppNotificationClientId(const std::string& extension_id) const; |
| 198 void SetAppNotificationClientId(const std::string& extension_id, | 200 void SetAppNotificationClientId(const std::string& extension_id, |
| 199 const std::string& oauth_client_id); | 201 const std::string& oauth_client_id); |
| 200 | 202 |
| 201 // Whether app notifications are disabled for the given app. | 203 // Whether app notifications are disabled for the given app. |
| 202 bool IsAppNotificationDisabled(const std::string& extension_id) const; | 204 bool IsAppNotificationDisabled(const std::string& extension_id) const; |
| 203 void SetAppNotificationDisabled(const std::string& extension_id, bool value); | 205 void SetAppNotificationDisabled(const std::string& extension_id, bool value); |
| 204 | 206 |
| 205 // Is the extension with |extension_id| allowed by policy (checking both | 207 // ExtensionManagementPolicy::Delegate implementation: |
|
Aaron Boodman
2012/05/17 22:41:06
We usually just say:
// ExtensionManagementPolicy
| |
| 206 // whitelist and blacklist). | 208 // Returns true if the extension with |extension_id| is allowed by policy |
|
Aaron Boodman
2012/05/17 22:41:06
I don't think this comment is necessary since the
Pam (message me for reviews)
2012/05/18 20:15:15
I clarified that this particular management policy
| |
| 207 bool IsExtensionAllowedByPolicy(const std::string& extension_id, | 209 // (checking both whitelist and blacklist). |
| 208 Extension::Location location) const; | 210 virtual bool UserMayInstall(const std::string& extension_id, |
| 211 Extension::Location location, | |
| 212 const std::string& extension_name, | |
| 213 string16* error) const OVERRIDE; | |
| 209 | 214 |
| 210 // Checks if extensions are blacklisted by default, by policy. When true, this | 215 // Checks if extensions are blacklisted by default, by policy. When true, this |
| 211 // means that even extensions without an ID should be blacklisted (e.g. | 216 // means that even extensions without an ID should be blacklisted (e.g. |
| 212 // from the command line, or when loaded as an unpacked extension). | 217 // from the command line, or when loaded as an unpacked extension). |
| 213 // IsExtensionAllowedByPolicy() also takes this into account, and should be | 218 // IsExtensionAllowedByPolicy() also takes this into account, and should be |
| 214 // used instead when the extension ID is known. | 219 // used instead when the extension ID is known. |
| 215 bool ExtensionsBlacklistedByDefault() const; | 220 bool ExtensionsBlacklistedByDefault() const; |
| 216 | 221 |
| 217 // Returns the last value set via SetLastPingDay. If there isn't such a | 222 // Returns the last value set via SetLastPingDay. If there isn't such a |
| 218 // pref, the returned Time will return true for is_null(). | 223 // pref, the returned Time will return true for is_null(). |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 // Contains all the logic for handling the order for various extension | 541 // Contains all the logic for handling the order for various extension |
| 537 // properties. | 542 // properties. |
| 538 scoped_ptr<ExtensionSorting> extension_sorting_; | 543 scoped_ptr<ExtensionSorting> extension_sorting_; |
| 539 | 544 |
| 540 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; | 545 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; |
| 541 | 546 |
| 542 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 547 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 543 }; | 548 }; |
| 544 | 549 |
| 545 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 550 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| OLD | NEW |