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 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool did_escalate); | 168 bool did_escalate); |
169 | 169 |
170 // Getter and setters for disabled reason. | 170 // Getter and setters for disabled reason. |
171 int GetDisableReasons(const std::string& extension_id); | 171 int GetDisableReasons(const std::string& extension_id); |
172 void AddDisableReason(const std::string& extension_id, | 172 void AddDisableReason(const std::string& extension_id, |
173 Extension::DisableReason disable_reason); | 173 Extension::DisableReason disable_reason); |
174 void RemoveDisableReason(const std::string& extension_id, | 174 void RemoveDisableReason(const std::string& extension_id, |
175 Extension::DisableReason disable_reason); | 175 Extension::DisableReason disable_reason); |
176 void ClearDisableReasons(const std::string& extension_id); | 176 void ClearDisableReasons(const std::string& extension_id); |
177 | 177 |
| 178 // Gets the set of extensions that have been blacklisted in prefs. |
| 179 std::set<std::string> GetBlacklistedExtensions(); |
| 180 |
| 181 // Sets whether the extension with |id| is blacklisted. |
| 182 void SetExtensionBlacklisted(const std::string& extension_id, |
| 183 bool is_blacklisted); |
| 184 |
178 // Returns the version string for the currently installed extension, or | 185 // Returns the version string for the currently installed extension, or |
179 // the empty string if not found. | 186 // the empty string if not found. |
180 std::string GetVersionString(const std::string& extension_id); | 187 std::string GetVersionString(const std::string& extension_id); |
181 | 188 |
182 // Re-writes the extension manifest into the prefs. | 189 // Re-writes the extension manifest into the prefs. |
183 // Called to change the extension's manifest when it's re-localized. | 190 // Called to change the extension's manifest when it's re-localized. |
184 void UpdateManifest(const Extension* extension); | 191 void UpdateManifest(const Extension* extension); |
185 | 192 |
186 // Returns extension path based on extension ID, or empty FilePath on error. | 193 // Returns extension path based on extension ID, or empty FilePath on error. |
187 FilePath GetExtensionPath(const std::string& extension_id); | 194 FilePath GetExtensionPath(const std::string& extension_id); |
188 | 195 |
189 // Returns base extensions install directory. | 196 // Returns base extensions install directory. |
190 const FilePath& install_directory() const { return install_directory_; } | 197 const FilePath& install_directory() const { return install_directory_; } |
191 | 198 |
192 // Updates the prefs based on the blacklist. | 199 // Returns whether the extension with |id| has its blacklist bit set. |
193 void UpdateBlacklist(const std::set<std::string>& blacklist_set); | 200 // |
194 | 201 // WARNING: this only checks the extension's entry in prefs! There may be |
195 // Returns whether the extension with |id| is blacklisted. | 202 // other reasons why an extension is blacklisted! You probably want to use |
196 // You probably don't want to call this method, see Blacklist::IsBlacklisted. | 203 // Blacklist::IsBlacklisted rather than this method. |
197 bool IsExtensionBlacklisted(const std::string& id) const; | 204 bool IsExtensionBlacklisted(const std::string& id) const; |
198 | 205 |
199 // Based on extension id, checks prefs to see if it is orphaned. | 206 // Based on extension id, checks prefs to see if it is orphaned. |
200 bool IsExtensionOrphaned(const std::string& id); | 207 bool IsExtensionOrphaned(const std::string& id); |
201 | 208 |
202 // Increment the count of how many times we prompted the user to acknowledge | 209 // Increment the count of how many times we prompted the user to acknowledge |
203 // the given extension, and return the new count. | 210 // the given extension, and return the new count. |
204 int IncrementAcknowledgePromptCount(const std::string& extension_id); | 211 int IncrementAcknowledgePromptCount(const std::string& extension_id); |
205 | 212 |
206 // Whether the user has acknowledged an external extension. | 213 // Whether the user has acknowledged an external extension. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // The underlying ExtensionSorting. | 495 // The underlying ExtensionSorting. |
489 ExtensionSorting* extension_sorting() const { | 496 ExtensionSorting* extension_sorting() const { |
490 return extension_sorting_.get(); | 497 return extension_sorting_.get(); |
491 } | 498 } |
492 | 499 |
493 // Describes the URLs that are able to install extensions. See | 500 // Describes the URLs that are able to install extensions. See |
494 // prefs::kExtensionAllowedInstallSites for more information. | 501 // prefs::kExtensionAllowedInstallSites for more information. |
495 URLPatternSet GetAllowedInstallSites(); | 502 URLPatternSet GetAllowedInstallSites(); |
496 | 503 |
497 private: | 504 private: |
498 friend class ExtensionPrefsUninstallExtension; // Unit test. | 505 friend class ExtensionPrefsBlacklistedExtensions; // Unit test. |
| 506 friend class ExtensionPrefsUninstallExtension; // Unit test. |
499 | 507 |
500 // See the Create methods. | 508 // See the Create methods. |
501 ExtensionPrefs(PrefService* prefs, | 509 ExtensionPrefs(PrefService* prefs, |
502 const FilePath& root_dir, | 510 const FilePath& root_dir, |
503 ExtensionPrefValueMap* extension_pref_value_map, | 511 ExtensionPrefValueMap* extension_pref_value_map, |
504 scoped_ptr<TimeProvider> time_provider); | 512 scoped_ptr<TimeProvider> time_provider); |
505 | 513 |
506 // If |extensions_disabled| is true, extension controlled preferences and | 514 // If |extensions_disabled| is true, extension controlled preferences and |
507 // content settings do not become effective. | 515 // content settings do not become effective. |
508 void Init(bool extensions_disabled); | 516 void Init(bool extensions_disabled); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 scoped_refptr<ContentSettingsStore> content_settings_store_; | 622 scoped_refptr<ContentSettingsStore> content_settings_store_; |
615 | 623 |
616 scoped_ptr<TimeProvider> time_provider_; | 624 scoped_ptr<TimeProvider> time_provider_; |
617 | 625 |
618 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 626 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
619 }; | 627 }; |
620 | 628 |
621 } // namespace extensions | 629 } // namespace extensions |
622 | 630 |
623 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 631 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |