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, so by definition |
195 // Returns whether the extension with |id| is blacklisted. | 202 // can only check extensions that prefs knows about. There may be other |
196 // You probably don't want to call this method, see Blacklist::IsBlacklisted. | 203 // sources of blacklist information, such as safebrowsing. You probably want |
| 204 // to use Blacklist::GetBlacklistedIDs rather than this method. |
197 bool IsExtensionBlacklisted(const std::string& id) const; | 205 bool IsExtensionBlacklisted(const std::string& id) const; |
198 | 206 |
199 // Based on extension id, checks prefs to see if it is orphaned. | 207 // Based on extension id, checks prefs to see if it is orphaned. |
200 bool IsExtensionOrphaned(const std::string& id); | 208 bool IsExtensionOrphaned(const std::string& id); |
201 | 209 |
202 // Increment the count of how many times we prompted the user to acknowledge | 210 // Increment the count of how many times we prompted the user to acknowledge |
203 // the given extension, and return the new count. | 211 // the given extension, and return the new count. |
204 int IncrementAcknowledgePromptCount(const std::string& extension_id); | 212 int IncrementAcknowledgePromptCount(const std::string& extension_id); |
205 | 213 |
206 // Whether the user has acknowledged an external extension. | 214 // 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. | 496 // The underlying ExtensionSorting. |
489 ExtensionSorting* extension_sorting() const { | 497 ExtensionSorting* extension_sorting() const { |
490 return extension_sorting_.get(); | 498 return extension_sorting_.get(); |
491 } | 499 } |
492 | 500 |
493 // Describes the URLs that are able to install extensions. See | 501 // Describes the URLs that are able to install extensions. See |
494 // prefs::kExtensionAllowedInstallSites for more information. | 502 // prefs::kExtensionAllowedInstallSites for more information. |
495 URLPatternSet GetAllowedInstallSites(); | 503 URLPatternSet GetAllowedInstallSites(); |
496 | 504 |
497 private: | 505 private: |
498 friend class ExtensionPrefsUninstallExtension; // Unit test. | 506 friend class ExtensionPrefsBlacklistedExtensions; // Unit test. |
| 507 friend class ExtensionPrefsUninstallExtension; // Unit test. |
499 | 508 |
500 // See the Create methods. | 509 // See the Create methods. |
501 ExtensionPrefs(PrefService* prefs, | 510 ExtensionPrefs(PrefService* prefs, |
502 const FilePath& root_dir, | 511 const FilePath& root_dir, |
503 ExtensionPrefValueMap* extension_pref_value_map, | 512 ExtensionPrefValueMap* extension_pref_value_map, |
504 scoped_ptr<TimeProvider> time_provider); | 513 scoped_ptr<TimeProvider> time_provider); |
505 | 514 |
506 // If |extensions_disabled| is true, extension controlled preferences and | 515 // If |extensions_disabled| is true, extension controlled preferences and |
507 // content settings do not become effective. | 516 // content settings do not become effective. |
508 void Init(bool extensions_disabled); | 517 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_; | 623 scoped_refptr<ContentSettingsStore> content_settings_store_; |
615 | 624 |
616 scoped_ptr<TimeProvider> time_provider_; | 625 scoped_ptr<TimeProvider> time_provider_; |
617 | 626 |
618 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 627 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
619 }; | 628 }; |
620 | 629 |
621 } // namespace extensions | 630 } // namespace extensions |
622 | 631 |
623 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 632 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
OLD | NEW |