| 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_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> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 LAUNCH_REGULAR, | 60 LAUNCH_REGULAR, |
| 61 LAUNCH_FULLSCREEN, | 61 LAUNCH_FULLSCREEN, |
| 62 LAUNCH_WINDOW, | 62 LAUNCH_WINDOW, |
| 63 | 63 |
| 64 // Launch an app in the in the way a click on the NTP would, | 64 // Launch an app in the in the way a click on the NTP would, |
| 65 // if no user pref were set. Update this constant to change | 65 // if no user pref were set. Update this constant to change |
| 66 // the default for the NTP and chrome.management.launchApp(). | 66 // the default for the NTP and chrome.management.launchApp(). |
| 67 LAUNCH_DEFAULT = LAUNCH_REGULAR | 67 LAUNCH_DEFAULT = LAUNCH_REGULAR |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Does not assume ownership of |prefs| and |incognito_prefs|. | 70 // Does not assume ownership of |prefs| and |extension_pref_value_map|. |
| 71 // If |extensions_disabled| is true, extension controlled preferences and |
| 72 // content settings do not become not effective. |
| 71 ExtensionPrefs(PrefService* prefs, | 73 ExtensionPrefs(PrefService* prefs, |
| 72 const FilePath& root_dir, | 74 const FilePath& root_dir, |
| 73 ExtensionPrefValueMap* extension_pref_value_map); | 75 ExtensionPrefValueMap* extension_pref_value_map, |
| 76 bool extensions_disabled); |
| 74 virtual ~ExtensionPrefs(); | 77 virtual ~ExtensionPrefs(); |
| 75 | 78 |
| 76 // Returns a copy of the Extensions prefs. | 79 // Returns a copy of the Extensions prefs. |
| 77 // TODO(erikkay) Remove this so that external consumers don't need to be | 80 // TODO(erikkay) Remove this so that external consumers don't need to be |
| 78 // aware of the internal structure of the preferences. | 81 // aware of the internal structure of the preferences. |
| 79 base::DictionaryValue* CopyCurrentExtensions(); | 82 base::DictionaryValue* CopyCurrentExtensions(); |
| 80 | 83 |
| 81 // Returns true if the specified external extension was uninstalled by the | 84 // Returns true if the specified external extension was uninstalled by the |
| 82 // user. | 85 // user. |
| 83 bool IsExternalExtensionUninstalled(const std::string& id) const; | 86 bool IsExternalExtensionUninstalled(const std::string& id) const; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 // Checks if kPrefBlacklist is set to true in the DictionaryValue. | 462 // Checks if kPrefBlacklist is set to true in the DictionaryValue. |
| 460 // Return false if the value is false or kPrefBlacklist does not exist. | 463 // Return false if the value is false or kPrefBlacklist does not exist. |
| 461 // This is used to decide if an extension is blacklisted. | 464 // This is used to decide if an extension is blacklisted. |
| 462 static bool IsBlacklistBitSet(base::DictionaryValue* ext); | 465 static bool IsBlacklistBitSet(base::DictionaryValue* ext); |
| 463 | 466 |
| 464 // Fix missing preference entries in the extensions that are were introduced | 467 // Fix missing preference entries in the extensions that are were introduced |
| 465 // in a later Chrome version. | 468 // in a later Chrome version. |
| 466 void FixMissingPrefs(const ExtensionIdSet& extension_ids); | 469 void FixMissingPrefs(const ExtensionIdSet& extension_ids); |
| 467 | 470 |
| 468 // Installs the persistent extension preferences into |prefs_|'s extension | 471 // Installs the persistent extension preferences into |prefs_|'s extension |
| 469 // pref store. | 472 // pref store. Does nothing if |extensions_disabled| is true. |
| 470 void InitPrefStore(); | 473 void InitPrefStore(bool extensions_disabled); |
| 471 | 474 |
| 472 // Migrates the permissions data in the pref store. | 475 // Migrates the permissions data in the pref store. |
| 473 void MigratePermissions(const ExtensionIdSet& extension_ids); | 476 void MigratePermissions(const ExtensionIdSet& extension_ids); |
| 474 | 477 |
| 475 // Checks whether there is a state pref for the extension and if so, whether | 478 // Checks whether there is a state pref for the extension and if so, whether |
| 476 // it matches |check_state|. | 479 // it matches |check_state|. |
| 477 bool DoesExtensionHaveState(const std::string& id, | 480 bool DoesExtensionHaveState(const std::string& id, |
| 478 Extension::State check_state) const; | 481 Extension::State check_state) const; |
| 479 | 482 |
| 480 // The pref service specific to this set of extension prefs. Owned by profile. | 483 // The pref service specific to this set of extension prefs. Owned by profile. |
| 481 PrefService* prefs_; | 484 PrefService* prefs_; |
| 482 | 485 |
| 483 // Base extensions install directory. | 486 // Base extensions install directory. |
| 484 FilePath install_directory_; | 487 FilePath install_directory_; |
| 485 | 488 |
| 486 // Weak pointer, owned by Profile. | 489 // Weak pointer, owned by Profile. |
| 487 ExtensionPrefValueMap* extension_pref_value_map_; | 490 ExtensionPrefValueMap* extension_pref_value_map_; |
| 488 | 491 |
| 489 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; | 492 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; |
| 490 | 493 |
| 491 // The URLs of all of the toolstrips. | 494 // The URLs of all of the toolstrips. |
| 492 URLList shelf_order_; | 495 URLList shelf_order_; |
| 493 | 496 |
| 494 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 497 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 495 }; | 498 }; |
| 496 | 499 |
| 497 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 500 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| OLD | NEW |