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

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

Issue 10014005: Add a preference for why an extension is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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
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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 LAUNCH_REGULAR, 64 LAUNCH_REGULAR,
65 LAUNCH_FULLSCREEN, 65 LAUNCH_FULLSCREEN,
66 LAUNCH_WINDOW, 66 LAUNCH_WINDOW,
67 67
68 // Launch an app in the in the way a click on the NTP would, 68 // Launch an app in the in the way a click on the NTP would,
69 // if no user pref were set. Update this constant to change 69 // if no user pref were set. Update this constant to change
70 // the default for the NTP and chrome.management.launchApp(). 70 // the default for the NTP and chrome.management.launchApp().
71 LAUNCH_DEFAULT = LAUNCH_REGULAR 71 LAUNCH_DEFAULT = LAUNCH_REGULAR
72 }; 72 };
73 73
74 // Used to record the reason an extension was disabled.
75 enum DisableReason {
76 DISABLE_UNKNOWN,
77 DISABLE_USER_ACTION,
78 DISABLE_PERMISSIONS_INCREASE,
79 DISABLE_RELOAD,
80 };
81
74 // Does not assume ownership of |prefs| and |extension_pref_value_map|. 82 // Does not assume ownership of |prefs| and |extension_pref_value_map|.
75 // Note that you must call Init() to finalize construction. 83 // Note that you must call Init() to finalize construction.
76 ExtensionPrefs(PrefService* prefs, 84 ExtensionPrefs(PrefService* prefs,
77 const FilePath& root_dir, 85 const FilePath& root_dir,
78 ExtensionPrefValueMap* extension_pref_value_map); 86 ExtensionPrefValueMap* extension_pref_value_map);
79 virtual ~ExtensionPrefs(); 87 virtual ~ExtensionPrefs();
80 88
81 // If |extensions_disabled| is true, extension controlled preferences and 89 // If |extensions_disabled| is true, extension controlled preferences and
82 // content settings do not become effective. 90 // content settings do not become effective.
83 void Init(bool extensions_disabled); 91 void Init(bool extensions_disabled);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 void SetBrowserActionVisibility(const Extension* extension, bool visible); 140 void SetBrowserActionVisibility(const Extension* extension, bool visible);
133 141
134 // Did the extension ask to escalate its permission during an upgrade? 142 // Did the extension ask to escalate its permission during an upgrade?
135 bool DidExtensionEscalatePermissions(const std::string& id); 143 bool DidExtensionEscalatePermissions(const std::string& id);
136 144
137 // If |did_escalate| is true, the preferences for |extension| will be set to 145 // If |did_escalate| is true, the preferences for |extension| will be set to
138 // require the install warning when the user tries to enable. 146 // require the install warning when the user tries to enable.
139 void SetDidExtensionEscalatePermissions(const Extension* extension, 147 void SetDidExtensionEscalatePermissions(const Extension* extension,
140 bool did_escalate); 148 bool did_escalate);
141 149
150 // Getter and setter for disabled reason.
151 DisableReason GetDisableReason(const std::string& extension_id);
152 void SetDisableReason(const std::string& extension_id,
153 DisableReason disable_reason);
154
142 // Returns the version string for the currently installed extension, or 155 // Returns the version string for the currently installed extension, or
143 // the empty string if not found. 156 // the empty string if not found.
144 std::string GetVersionString(const std::string& extension_id); 157 std::string GetVersionString(const std::string& extension_id);
145 158
146 // Re-writes the extension manifest into the prefs. 159 // Re-writes the extension manifest into the prefs.
147 // Called to change the extension's manifest when it's re-localized. 160 // Called to change the extension's manifest when it's re-localized.
148 void UpdateManifest(const Extension* extension); 161 void UpdateManifest(const Extension* extension);
149 162
150 // Returns extension path based on extension ID, or empty FilePath on error. 163 // Returns extension path based on extension ID, or empty FilePath on error.
151 FilePath GetExtensionPath(const std::string& extension_id); 164 FilePath GetExtensionPath(const std::string& extension_id);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // Contains all the logic for handling the order for various extension 517 // Contains all the logic for handling the order for various extension
505 // properties. 518 // properties.
506 scoped_ptr<ExtensionSorting> extension_sorting_; 519 scoped_ptr<ExtensionSorting> extension_sorting_;
507 520
508 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_; 521 scoped_refptr<ExtensionContentSettingsStore> content_settings_store_;
509 522
510 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 523 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
511 }; 524 };
512 525
513 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 526 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698