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

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

Issue 1157005: Fix 2 bugs related to remembering loaded unpacked extensions. (Closed)
Patch Set: review feedback 2 Created 10 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Called when an extension is uninstalled, so that prefs get cleaned up. 52 // Called when an extension is uninstalled, so that prefs get cleaned up.
53 void OnExtensionUninstalled(const Extension* extension, 53 void OnExtensionUninstalled(const Extension* extension,
54 bool external_uninstall); 54 bool external_uninstall);
55 55
56 // Returns the state (enabled/disabled) of the given extension. 56 // Returns the state (enabled/disabled) of the given extension.
57 Extension::State GetExtensionState(const std::string& extension_id); 57 Extension::State GetExtensionState(const std::string& extension_id);
58 58
59 // Called to change the extension's state when it is enabled/disabled. 59 // Called to change the extension's state when it is enabled/disabled.
60 void SetExtensionState(Extension* extension, Extension::State); 60 void SetExtensionState(Extension* extension, Extension::State);
61 61
62 // If |require| is true, the preferences for |extension| will be set to 62 // Did the extension ask to escalate its permission during an upgrade?
63 bool DidExtensionEscalatePermissions(const std::string& id);
64
65 // If |did_escalate| is true, the preferences for |extension| will be set to
63 // require the install warning when the user tries to enable. 66 // require the install warning when the user tries to enable.
64 void SetShowInstallWarningOnEnable(Extension* extension, bool require); 67 void SetDidExtensionEscalatePermissions(Extension* extension,
68 bool did_escalate);
65 69
66 // Returns the version string for the currently installed extension, or 70 // Returns the version string for the currently installed extension, or
67 // the empty string if not found. 71 // the empty string if not found.
68 std::string GetVersionString(const std::string& extension_id); 72 std::string GetVersionString(const std::string& extension_id);
69 73
70 // Re-writes the extension manifest into the prefs. 74 // Re-writes the extension manifest into the prefs.
71 // Called to change the extension's manifest when it's re-localized. 75 // Called to change the extension's manifest when it's re-localized.
72 void UpdateManifest(Extension* extension); 76 void UpdateManifest(Extension* extension);
73 77
74 // Returns extension path based on extension ID, or empty FilePath on error. 78 // Returns extension path based on extension ID, or empty FilePath on error.
75 FilePath GetExtensionPath(const std::string& extension_id); 79 FilePath GetExtensionPath(const std::string& extension_id);
76 80
77 // Returns base extensions install directory. 81 // Returns base extensions install directory.
78 const FilePath& install_directory() const { return install_directory_; } 82 const FilePath& install_directory() const { return install_directory_; }
79 83
80 // Updates the prefs based on the blacklist. 84 // Updates the prefs based on the blacklist.
81 void UpdateBlacklist(const std::set<std::string>& blacklist_set); 85 void UpdateBlacklist(const std::set<std::string>& blacklist_set);
82 86
83 // Based on extension id, checks prefs to see if it is blacklisted. 87 // Based on extension id, checks prefs to see if it is blacklisted.
84 bool IsExtensionBlacklisted(const std::string& id); 88 bool IsExtensionBlacklisted(const std::string& id);
85 89
86 // Did the extension ask to escalate its permission during an upgrade?
87 bool DidExtensionEscalatePermissions(const std::string& id);
88
89 // Returns the last value set via SetLastPingDay. If there isn't such a 90 // Returns the last value set via SetLastPingDay. If there isn't such a
90 // pref, the returned Time will return true for is_null(). 91 // pref, the returned Time will return true for is_null().
91 base::Time LastPingDay(const std::string& extension_id); 92 base::Time LastPingDay(const std::string& extension_id);
92 93
93 // The time stored is based on the server's perspective of day start time, not 94 // The time stored is based on the server's perspective of day start time, not
94 // the client's. 95 // the client's.
95 void SetLastPingDay(const std::string& extension_id, const base::Time& time); 96 void SetLastPingDay(const std::string& extension_id, const base::Time& time);
96 97
97 // Returns true if the user enabled this extension to be loaded in incognito 98 // Returns true if the user enabled this extension to be loaded in incognito
98 // mode. 99 // mode.
99 bool IsIncognitoEnabled(const std::string& extension_id); 100 bool IsIncognitoEnabled(const std::string& extension_id);
100 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled); 101 void SetIsIncognitoEnabled(const std::string& extension_id, bool enabled);
101 102
102 // Saves ExtensionInfo for each installed extension with the path to the 103 // Saves ExtensionInfo for each installed extension with the path to the
103 // version directory and the location. Blacklisted extensions won't be saved 104 // version directory and the location. Blacklisted extensions won't be saved
104 // and neither will external extensions the user has explicitly uninstalled. 105 // and neither will external extensions the user has explicitly uninstalled.
105 // Caller takes ownership of returned structure. 106 // Caller takes ownership of returned structure.
106 static ExtensionsInfo* CollectExtensionsInfo(ExtensionPrefs* extension_prefs); 107 ExtensionsInfo* GetInstalledExtensionsInfo();
108
109 // Returns the ExtensionInfo from the prefs for the given extension. If the
110 // extension is not present, NULL is returned.
111 ExtensionInfo* GetInstalledExtensionInfo(const std::string& extension_id);
107 112
108 static void RegisterUserPrefs(PrefService* prefs); 113 static void RegisterUserPrefs(PrefService* prefs);
109 114
110 private: 115 private:
111 116
112 // Converts absolute paths in the pref to paths relative to the 117 // Converts absolute paths in the pref to paths relative to the
113 // install_directory_. 118 // install_directory_.
114 void MakePathsRelative(); 119 void MakePathsRelative();
115 120
116 // Converts internal relative paths to be absolute. Used for export to 121 // Converts internal relative paths to be absolute. Used for export to
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 FilePath install_directory_; 156 FilePath install_directory_;
152 157
153 // The URLs of all of the toolstrips. 158 // The URLs of all of the toolstrips.
154 URLList shelf_order_; 159 URLList shelf_order_;
155 160
156 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 161 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
157 }; 162 };
158 163
159 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 164 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
160 165
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_disabled_infobar_delegate.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698