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

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

Issue 14990002: Make sure keybindings removed don't come back during extension update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove command handler Created 7 years, 7 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 #include "chrome/browser/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_notifier.h" 8 #include "base/prefs/pref_notifier.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const char kPrefCreationFlags[] = "creation_flags"; 177 const char kPrefCreationFlags[] = "creation_flags";
178 178
179 // A preference that indicates whether the extension was installed from the 179 // A preference that indicates whether the extension was installed from the
180 // Chrome Web Store. 180 // Chrome Web Store.
181 const char kPrefFromWebStore[] = "from_webstore"; 181 const char kPrefFromWebStore[] = "from_webstore";
182 182
183 // A preference that indicates whether the extension was installed from a 183 // A preference that indicates whether the extension was installed from a
184 // mock App created from a bookmark. 184 // mock App created from a bookmark.
185 const char kPrefFromBookmark[] = "from_bookmark"; 185 const char kPrefFromBookmark[] = "from_bookmark";
186 186
187 // A prefrence that indicates whethere the extension was installed as 187 // A preference that indicates whether the extension was installed as
188 // default apps. 188 // default apps.
189 const char kPrefWasInstalledByDefault[] = "was_installed_by_default"; 189 const char kPrefWasInstalledByDefault[] = "was_installed_by_default";
190 190
191 // A preference that indicates that the initial keybindings for the given
192 // extension have been set.
193 const char kInitialBindingsHaveBeenAssigned[] = "initial_keybindings_set";
194
191 // A preference that contains any extension-controlled preferences. 195 // A preference that contains any extension-controlled preferences.
192 const char kPrefPreferences[] = "preferences"; 196 const char kPrefPreferences[] = "preferences";
193 197
194 // A preference that contains any extension-controlled incognito preferences. 198 // A preference that contains any extension-controlled incognito preferences.
195 const char kPrefIncognitoPreferences[] = "incognito_preferences"; 199 const char kPrefIncognitoPreferences[] = "incognito_preferences";
196 200
197 // A preference that contains any extension-controlled regular-only preferences. 201 // A preference that contains any extension-controlled regular-only preferences.
198 const char kPrefRegularOnlyPreferences[] = "regular_only_preferences"; 202 const char kPrefRegularOnlyPreferences[] = "regular_only_preferences";
199 203
200 // A preference that contains extension-set content settings. 204 // A preference that contains extension-set content settings.
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 bool ExtensionPrefs::WasInstalledByDefault( 1761 bool ExtensionPrefs::WasInstalledByDefault(
1758 const std::string& extension_id) const { 1762 const std::string& extension_id) const {
1759 const DictionaryValue* dictionary = GetExtensionPref(extension_id); 1763 const DictionaryValue* dictionary = GetExtensionPref(extension_id);
1760 bool result = false; 1764 bool result = false;
1761 if (dictionary && 1765 if (dictionary &&
1762 dictionary->GetBoolean(kPrefWasInstalledByDefault, &result)) 1766 dictionary->GetBoolean(kPrefWasInstalledByDefault, &result))
1763 return result; 1767 return result;
1764 return false; 1768 return false;
1765 } 1769 }
1766 1770
1771 void ExtensionPrefs::SetInitialBindingsHaveBeenAssigned(
1772 const std::string& extension_id) {
1773 UpdateExtensionPref(extension_id, kInitialBindingsHaveBeenAssigned,
1774 Value::CreateBooleanValue(true));
1775 }
1776
1777 bool ExtensionPrefs::InitialBindingsHaveBeenAssigned(
1778 const std::string& extension_id) const {
1779 const DictionaryValue* dictionary = GetExtensionPref(extension_id);
1780 bool result = false;
1781 if (dictionary &&
1782 dictionary->GetBoolean(kInitialBindingsHaveBeenAssigned, &result))
1783 return result;
1784 return false;
1785 }
1786
1767 base::Time ExtensionPrefs::GetInstallTime( 1787 base::Time ExtensionPrefs::GetInstallTime(
1768 const std::string& extension_id) const { 1788 const std::string& extension_id) const {
1769 const DictionaryValue* extension = GetExtensionPref(extension_id); 1789 const DictionaryValue* extension = GetExtensionPref(extension_id);
1770 if (!extension) { 1790 if (!extension) {
1771 NOTREACHED(); 1791 NOTREACHED();
1772 return base::Time(); 1792 return base::Time();
1773 } 1793 }
1774 std::string install_time_str; 1794 std::string install_time_str;
1775 if (!extension->GetString(kPrefInstallTime, &install_time_str)) 1795 if (!extension->GetString(kPrefInstallTime, &install_time_str))
1776 return base::Time(); 1796 return base::Time();
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 is_enabled = initial_state == Extension::ENABLED; 2268 is_enabled = initial_state == Extension::ENABLED;
2249 } 2269 }
2250 2270
2251 extension_pref_value_map_->RegisterExtension(extension_id, install_time, 2271 extension_pref_value_map_->RegisterExtension(extension_id, install_time,
2252 is_enabled); 2272 is_enabled);
2253 content_settings_store_->RegisterExtension(extension_id, install_time, 2273 content_settings_store_->RegisterExtension(extension_id, install_time,
2254 is_enabled); 2274 is_enabled);
2255 } 2275 }
2256 2276
2257 } // namespace extensions 2277 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698