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

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

Issue 9620010: Added Protector backup for Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace. Created 8 years, 9 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/protector/protector_service.h" 5 #include "chrome/browser/protector/protector_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/protector/settings_change_global_error.h" 11 #include "chrome/browser/protector/settings_change_global_error.h"
12 #include "chrome/browser/protector/keys.h" 12 #include "chrome/browser/protector/keys.h"
13 #include "chrome/browser/protector/protected_prefs_watcher.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
18 #include "crypto/hmac.h" 19 #include "crypto/hmac.h"
19 20
20 namespace protector { 21 namespace protector {
21 22
22 ProtectorService::ProtectorService(Profile* profile) 23 ProtectorService::ProtectorService(Profile* profile)
23 : profile_(profile) { 24 : profile_(profile) {
25 // Start observing pref changes.
26 prefs_watcher_.reset(new ProtectedPrefsWatcher(profile));
27 prefs_watcher_->CheckForPrefChanges();
24 } 28 }
25 29
26 ProtectorService::~ProtectorService() { 30 ProtectorService::~ProtectorService() {
27 DCHECK(!IsShowingChange()); // Should have been dismissed by Shutdown. 31 DCHECK(!IsShowingChange()); // Should have been dismissed by Shutdown.
28 } 32 }
29 33
30 void ProtectorService::ShowChange(BaseSettingChange* change) { 34 void ProtectorService::ShowChange(BaseSettingChange* change) {
31 DCHECK(change); 35 DCHECK(change);
32 Item new_item; 36 Item new_item;
33 new_item.change.reset(change); 37 new_item.change.reset(change);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return false; 156 return false;
153 } 157 }
154 return hmac.Verify(value, signature); 158 return hmac.Verify(value, signature);
155 } 159 }
156 160
157 bool IsEnabled() { 161 bool IsEnabled() {
158 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoProtector); 162 return !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoProtector);
159 } 163 }
160 164
161 } // namespace protector 165 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698