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

Side by Side Diff: chrome/browser/protector/protected_prefs_watcher.cc

Issue 10854009: Extension white and force lists (set by policy) should have priority over auto-updated Google black… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed NULL instead of false 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
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/protector/protected_prefs_watcher.h" 5 #include "chrome/browser/protector/protected_prefs_watcher.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 DCHECK(pref_name && pref_observer_->IsObserved(*pref_name)); 193 DCHECK(pref_name && pref_observer_->IsObserved(*pref_name));
194 if (UpdateBackupEntry(*pref_name)) 194 if (UpdateBackupEntry(*pref_name))
195 UpdateBackupSignature(); 195 UpdateBackupSignature();
196 } 196 }
197 197
198 void ProtectedPrefsWatcher::EnsurePrefsMigration() { 198 void ProtectedPrefsWatcher::EnsurePrefsMigration() {
199 SessionStartupPref::MigrateIfNecessary(profile_->GetPrefs()); 199 SessionStartupPref::MigrateIfNecessary(profile_->GetPrefs());
200 } 200 }
201 201
202 bool ProtectedPrefsWatcher::UpdateCachedPrefs() { 202 bool ProtectedPrefsWatcher::UpdateCachedPrefs() {
203 // Direct access to the extensions prefs is required becase ExtensionService
Ivan Korotkov 2012/08/07 13:26:40 Did something change in the initialization order?
qfel 2012/08/07 13:43:51 I guess I should have left the part about being un
204 // may not yet have been initialized.
205 const base::DictionaryValue* extension_prefs;
206 const base::Value* extension_prefs_value =
207 profile_->GetPrefs()->GetUserPrefValue(ExtensionPrefs::kExtensionsPref);
208 if (!extension_prefs_value ||
209 !extension_prefs_value->GetAsDictionary(&extension_prefs)) {
210 return false;
211 }
212 ExtensionPrefs::ExtensionIdSet extension_ids = 203 ExtensionPrefs::ExtensionIdSet extension_ids =
213 ExtensionPrefs::GetExtensionsFrom(extension_prefs); 204 ExtensionPrefs::GetExtensionsFrom(profile_->GetPrefs());
214 if (extension_ids == cached_extension_ids_) 205 if (extension_ids == cached_extension_ids_)
215 return false; 206 return false;
216 cached_extension_ids_.swap(extension_ids); 207 cached_extension_ids_.swap(extension_ids);
217 return true; 208 return true;
218 } 209 }
219 210
220 bool ProtectedPrefsWatcher::HasBackup() const { 211 bool ProtectedPrefsWatcher::HasBackup() const {
221 // TODO(ivankr): as soon as some irreversible change to Preferences happens, 212 // TODO(ivankr): as soon as some irreversible change to Preferences happens,
222 // add a condition that this change has occured as well (otherwise it's 213 // add a condition that this change has occured as well (otherwise it's
223 // possible to simply clear the "backup" dictionary to make settings 214 // possible to simply clear the "backup" dictionary to make settings
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 NOTREACHED(); 379 NOTREACHED();
389 continue; 380 continue;
390 } 381 }
391 StringAppendStringDictionary(tab, &data); 382 StringAppendStringDictionary(tab, &data);
392 } 383 }
393 } 384 }
394 return data; 385 return data;
395 } 386 }
396 387
397 } // namespace protector 388 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698