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

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

Issue 23694020: Don't clear existing extension-defined preferences and content settings when reloading or updating… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 7 years, 3 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_pref_value_map.h" 5 #include "chrome/browser/extensions/extension_pref_value_map.h"
6 6
7 #include "base/prefs/pref_value_map.h" 7 #include "base/prefs/pref_value_map.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 const std::string& pref_key, 106 const std::string& pref_key,
107 bool* from_incognito) const { 107 bool* from_incognito) const {
108 bool incognito = (from_incognito != NULL); 108 bool incognito = (from_incognito != NULL);
109 ExtensionEntryMap::const_iterator winner = 109 ExtensionEntryMap::const_iterator winner =
110 GetEffectivePrefValueController(pref_key, incognito, from_incognito); 110 GetEffectivePrefValueController(pref_key, incognito, from_incognito);
111 if (winner == entries_.end()) 111 if (winner == entries_.end())
112 return false; 112 return false;
113 return winner->first == extension_id; 113 return winner->first == extension_id;
114 } 114 }
115 115
116 void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id, 116 void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id,
Jeffrey Yasskin 2013/09/06 21:31:56 This is called from PreferenceAPI::InitExtensionCo
Bernhard Bauer 2013/09/09 21:02:03 Yes, PreferenceAPI::InitExtensionControlledPrefs()
117 const base::Time& install_time, 117 const base::Time& install_time,
118 bool is_enabled) { 118 bool is_enabled) {
119 if (entries_.find(ext_id) != entries_.end()) 119 if (entries_.find(ext_id) != entries_.end())
120 UnregisterExtension(ext_id); 120 return;
121
121 entries_[ext_id] = new ExtensionEntry; 122 entries_[ext_id] = new ExtensionEntry;
122 entries_[ext_id]->install_time = install_time; 123 entries_[ext_id]->install_time = install_time;
Jeffrey Yasskin 2013/09/06 21:31:56 Using the older install time is probably right in
123 entries_[ext_id]->enabled = is_enabled; 124 entries_[ext_id]->enabled = is_enabled;
Jeffrey Yasskin 2013/09/06 21:31:56 When we re-install an extension, it seems like we'
Bernhard Bauer 2013/09/09 21:02:03 What do you mean by up to date?
Jeffrey Yasskin 2013/09/09 21:15:28 Say the extension is disabled, but RegisterExtensi
Bernhard Bauer 2013/09/09 21:31:46 Gotcha. Yes, that makes sense.
124 } 125 }
125 126
126 void ExtensionPrefValueMap::UnregisterExtension(const std::string& ext_id) { 127 void ExtensionPrefValueMap::UnregisterExtension(const std::string& ext_id) {
127 ExtensionEntryMap::iterator i = entries_.find(ext_id); 128 ExtensionEntryMap::iterator i = entries_.find(ext_id);
128 if (i == entries_.end()) 129 if (i == entries_.end())
129 return; 130 return;
130 std::set<std::string> keys; // keys set by this extension 131 std::set<std::string> keys; // keys set by this extension
131 GetExtensionControlledKeys(*(i->second), &keys); 132 GetExtensionControlledKeys(*(i->second), &keys);
132 133
133 delete i->second; 134 delete i->second;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 356
356 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { 357 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) {
357 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 358 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_,
358 OnPrefValueChanged(key)); 359 OnPrefValueChanged(key));
359 } 360 }
360 361
361 void ExtensionPrefValueMap::NotifyOfDestruction() { 362 void ExtensionPrefValueMap::NotifyOfDestruction() {
362 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 363 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_,
363 OnExtensionPrefValueMapDestruction()); 364 OnExtensionPrefValueMapDestruction());
364 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698