Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: chrome/browser/extensions/extension_prefs.h

Issue 10824344: Renamed ExtensionIdSet to ExtensionIds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: undid files where I went too far Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // 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
54 // extension ids. 54 // extension ids.
55 static const char kExtensionsPref[]; 55 static const char kExtensionsPref[];
56 56
57 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; 57 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo;
58 58
59 // Vector containing identifiers for preferences. 59 // Vector containing identifiers for preferences.
60 typedef std::set<std::string> PrefKeySet; 60 typedef std::set<std::string> PrefKeySet;
61 61
62 // Vector containing identifiers for extensions. 62 // Vector containing identifiers for extensions.
63 // TODO(yefim): rename to ExtensionIds. 63 typedef std::vector<std::string> ExtensionIds;
64 typedef std::vector<std::string> ExtensionIdSet;
65 64
66 // This enum is used for the launch type the user wants to use for an 65 // This enum is used for the launch type the user wants to use for an
67 // application. 66 // application.
68 // Do not remove items or re-order this enum as it is used in preferences 67 // Do not remove items or re-order this enum as it is used in preferences
69 // and histograms. 68 // and histograms.
70 enum LaunchType { 69 enum LaunchType {
71 LAUNCH_PINNED, 70 LAUNCH_PINNED,
72 LAUNCH_REGULAR, 71 LAUNCH_REGULAR,
73 LAUNCH_FULLSCREEN, 72 LAUNCH_FULLSCREEN,
74 LAUNCH_WINDOW, 73 LAUNCH_WINDOW,
(...skipping 23 matching lines...) Expand all
98 // Returns true if the specified external extension was uninstalled by the 97 // Returns true if the specified external extension was uninstalled by the
99 // user. 98 // user.
100 bool IsExternalExtensionUninstalled(const std::string& id) const; 99 bool IsExternalExtensionUninstalled(const std::string& id) const;
101 100
102 // Checks whether |extension_id| is disabled. If there's no state pref for 101 // Checks whether |extension_id| is disabled. If there's no state pref for
103 // the extension, this will return false. Generally you should use 102 // the extension, this will return false. Generally you should use
104 // ExtensionService::IsExtensionEnabled instead. 103 // ExtensionService::IsExtensionEnabled instead.
105 bool IsExtensionDisabled(const std::string& id) const; 104 bool IsExtensionDisabled(const std::string& id) const;
106 105
107 // Get/Set the order that the browser actions appear in the toolbar. 106 // Get/Set the order that the browser actions appear in the toolbar.
108 ExtensionIdSet GetToolbarOrder(); 107 ExtensionIds GetToolbarOrder();
109 void SetToolbarOrder(const ExtensionIdSet& extension_ids); 108 void SetToolbarOrder(const ExtensionIds& extension_ids);
110 109
111 // Get/Set the order that the browser actions appear in the action box. 110 // Get/Set the order that the browser actions appear in the action box.
112 ExtensionIdSet GetActionBoxOrder(); 111 ExtensionIds GetActionBoxOrder();
113 void SetActionBoxOrder(const ExtensionIdSet& extension_ids); 112 void SetActionBoxOrder(const ExtensionIds& extension_ids);
114 113
115 // Called when an extension is installed, so that prefs get created. 114 // Called when an extension is installed, so that prefs get created.
116 // If |page_ordinal| is an invalid ordinal, then a page will be found 115 // If |page_ordinal| is an invalid ordinal, then a page will be found
117 // for the App. 116 // for the App.
118 void OnExtensionInstalled(const Extension* extension, 117 void OnExtensionInstalled(const Extension* extension,
119 Extension::State initial_state, 118 Extension::State initial_state,
120 bool from_webstore, 119 bool from_webstore,
121 const StringOrdinal& page_ordinal); 120 const StringOrdinal& page_ordinal);
122 121
123 // Called when an extension is uninstalled, so that prefs get cleaned up. 122 // Called when an extension is uninstalled, so that prefs get cleaned up.
124 void OnExtensionUninstalled(const std::string& extension_id, 123 void OnExtensionUninstalled(const std::string& extension_id,
125 const Extension::Location& location, 124 const Extension::Location& location,
126 bool external_uninstall); 125 bool external_uninstall);
127 126
128 // Called to change the extension's state when it is enabled/disabled. 127 // Called to change the extension's state when it is enabled/disabled.
129 void SetExtensionState(const std::string& extension_id, Extension::State); 128 void SetExtensionState(const std::string& extension_id, Extension::State);
130 129
131 // Returns all installed extensions 130 // Returns all installed extensions
132 void GetExtensions(ExtensionIdSet* out); 131 void GetExtensions(ExtensionIds* out);
133 132
134 // Returns all installed extensions from |extension_prefs|. This is exposed 133 // Returns all installed extensions from |extension_prefs|. This is exposed
135 // for ProtectedPrefsWatcher because it needs access to the extension ID list 134 // for ProtectedPrefsWatcher because it needs access to the extension ID list
136 // before the ExtensionService is initialized. 135 // before the ExtensionService is initialized.
137 static ExtensionIdSet GetExtensionsFrom( 136 static ExtensionIds GetExtensionsFrom(
138 const base::DictionaryValue* extension_prefs); 137 const base::DictionaryValue* extension_prefs);
139 138
140 // Getter and setter for browser action visibility. 139 // Getter and setter for browser action visibility.
141 bool GetBrowserActionVisibility(const Extension* extension); 140 bool GetBrowserActionVisibility(const Extension* extension);
142 void SetBrowserActionVisibility(const Extension* extension, 141 void SetBrowserActionVisibility(const Extension* extension,
143 bool visible); 142 bool visible);
144 143
145 // Did the extension ask to escalate its permission during an upgrade? 144 // Did the extension ask to escalate its permission during an upgrade?
146 bool DidExtensionEscalatePermissions(const std::string& id); 145 bool DidExtensionEscalatePermissions(const std::string& id);
147 146
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 void LoadExtensionControlledPrefs(const std::string& id, 538 void LoadExtensionControlledPrefs(const std::string& id,
540 ExtensionPrefsScope scope); 539 ExtensionPrefsScope scope);
541 540
542 // Checks if kPrefBlacklist is set to true in the DictionaryValue. 541 // Checks if kPrefBlacklist is set to true in the DictionaryValue.
543 // Return false if the value is false or kPrefBlacklist does not exist. 542 // Return false if the value is false or kPrefBlacklist does not exist.
544 // This is used to decide if an extension is blacklisted. 543 // This is used to decide if an extension is blacklisted.
545 static bool IsBlacklistBitSet(const base::DictionaryValue* ext); 544 static bool IsBlacklistBitSet(const base::DictionaryValue* ext);
546 545
547 // Fix missing preference entries in the extensions that are were introduced 546 // Fix missing preference entries in the extensions that are were introduced
548 // in a later Chrome version. 547 // in a later Chrome version.
549 void FixMissingPrefs(const ExtensionIdSet& extension_ids); 548 void FixMissingPrefs(const ExtensionIds& extension_ids);
550 549
551 // Installs the persistent extension preferences into |prefs_|'s extension 550 // Installs the persistent extension preferences into |prefs_|'s extension
552 // pref store. Does nothing if |extensions_disabled| is true. 551 // pref store. Does nothing if |extensions_disabled| is true.
553 void InitPrefStore(bool extensions_disabled); 552 void InitPrefStore(bool extensions_disabled);
554 553
555 // Migrates the permissions data in the pref store. 554 // Migrates the permissions data in the pref store.
556 void MigratePermissions(const ExtensionIdSet& extension_ids); 555 void MigratePermissions(const ExtensionIds& extension_ids);
557 556
558 // Migrates the disable reasons from a single enum to a bit mask. 557 // Migrates the disable reasons from a single enum to a bit mask.
559 void MigrateDisableReasons(const ExtensionIdSet& extension_ids); 558 void MigrateDisableReasons(const ExtensionIds& extension_ids);
560 559
561 // Checks whether there is a state pref for the extension and if so, whether 560 // Checks whether there is a state pref for the extension and if so, whether
562 // it matches |check_state|. 561 // it matches |check_state|.
563 bool DoesExtensionHaveState(const std::string& id, 562 bool DoesExtensionHaveState(const std::string& id,
564 Extension::State check_state) const; 563 Extension::State check_state) const;
565 564
566 // Helper function to Get/Set array of strings from/to prefs. 565 // Helper function to Get/Set array of strings from/to prefs.
567 ExtensionIdSet GetExtensionPrefAsVector(const char* pref); 566 ExtensionIds GetExtensionPrefAsVector(const char* pref);
568 void SetExtensionPrefFromVector(const char* pref, 567 void SetExtensionPrefFromVector(const char* pref,
569 const ExtensionIdSet& extension_ids); 568 const ExtensionIds& extension_ids);
570 569
571 // The pref service specific to this set of extension prefs. Owned by profile. 570 // The pref service specific to this set of extension prefs. Owned by profile.
572 PrefService* prefs_; 571 PrefService* prefs_;
573 572
574 // Base extensions install directory. 573 // Base extensions install directory.
575 FilePath install_directory_; 574 FilePath install_directory_;
576 575
577 // Weak pointer, owned by Profile. 576 // Weak pointer, owned by Profile.
578 ExtensionPrefValueMap* extension_pref_value_map_; 577 ExtensionPrefValueMap* extension_pref_value_map_;
579 578
580 // Contains all the logic for handling the order for various extension 579 // Contains all the logic for handling the order for various extension
581 // properties. 580 // properties.
582 scoped_ptr<ExtensionSorting> extension_sorting_; 581 scoped_ptr<ExtensionSorting> extension_sorting_;
583 582
584 scoped_refptr<ContentSettingsStore> content_settings_store_; 583 scoped_refptr<ContentSettingsStore> content_settings_store_;
585 584
586 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 585 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
587 }; 586 };
588 587
589 } // namespace extensions 588 } // namespace extensions
590 589
591 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 590 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698