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

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

Issue 10702040: Cleanup & tests for the mac startup pref migration. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: oops Created 8 years, 5 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 const content::NotificationDetails& details) { 188 const content::NotificationDetails& details) {
189 DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED); 189 DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED);
190 const std::string* pref_name = content::Details<std::string>(details).ptr(); 190 const std::string* pref_name = content::Details<std::string>(details).ptr();
191 DCHECK(pref_name && pref_observer_->IsObserved(*pref_name)); 191 DCHECK(pref_name && pref_observer_->IsObserved(*pref_name));
192 if (UpdateBackupEntry(*pref_name)) 192 if (UpdateBackupEntry(*pref_name))
193 UpdateBackupSignature(); 193 UpdateBackupSignature();
194 } 194 }
195 195
196 void ProtectedPrefsWatcher::EnsurePrefsMigration() { 196 void ProtectedPrefsWatcher::EnsurePrefsMigration() {
197 SessionStartupPref::MigrateIfNecessary(profile_->GetPrefs()); 197 SessionStartupPref::MigrateIfNecessary(profile_->GetPrefs());
198 SessionStartupPref::MigrateMacDefaultPrefIfNecessary(profile_->GetPrefs());
198 } 199 }
199 200
200 bool ProtectedPrefsWatcher::UpdateCachedPrefs() { 201 bool ProtectedPrefsWatcher::UpdateCachedPrefs() {
201 // Direct access to the extensions prefs is required becase ExtensionService 202 // Direct access to the extensions prefs is required becase ExtensionService
202 // may not yet have been initialized. 203 // may not yet have been initialized.
203 const base::DictionaryValue* extension_prefs; 204 const base::DictionaryValue* extension_prefs;
204 const base::Value* extension_prefs_value = 205 const base::Value* extension_prefs_value =
205 profile_->GetPrefs()->GetUserPrefValue(ExtensionPrefs::kExtensionsPref); 206 profile_->GetPrefs()->GetUserPrefValue(ExtensionPrefs::kExtensionsPref);
206 if (!extension_prefs_value || 207 if (!extension_prefs_value ||
207 !extension_prefs_value->GetAsDictionary(&extension_prefs)) { 208 !extension_prefs_value->GetAsDictionary(&extension_prefs)) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 NOTREACHED(); 387 NOTREACHED();
387 continue; 388 continue;
388 } 389 }
389 StringAppendStringDictionary(tab, &data); 390 StringAppendStringDictionary(tab, &data);
390 } 391 }
391 } 392 }
392 return data; 393 return data;
393 } 394 }
394 395
395 } // namespace protector 396 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698