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

Side by Side Diff: chrome/browser/prefs/pref_change_registrar.cc

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed whitespaces in mac files Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/prefs/pref_change_registrar.h" 5 #include "chrome/browser/prefs/pref_change_registrar.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 9
10 PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {} 10 PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {}
11 11
12 PrefChangeRegistrar::~PrefChangeRegistrar() { 12 PrefChangeRegistrar::~PrefChangeRegistrar() {
13 // If you see an invalid memory access in this destructor, this
14 // PrefChangeRegistrar might be subscribed to an OffTheRecordProfileImpl that
15 // has been destroyed. This should not happen any more but be warned.
16 // Feel free to contact battre@chromium.org in case this happens.
13 RemoveAll(); 17 RemoveAll();
14 } 18 }
15 19
16 void PrefChangeRegistrar::Init(PrefService* service) { 20 void PrefChangeRegistrar::Init(PrefService* service) {
17 DCHECK(IsEmpty() || service_ == service); 21 DCHECK(IsEmpty() || service_ == service);
18 service_ = service; 22 service_ = service;
19 } 23 }
20 24
21 void PrefChangeRegistrar::Add(const char* path, NotificationObserver* obs) { 25 void PrefChangeRegistrar::Add(const char* path, NotificationObserver* obs) {
22 if (!service_) { 26 if (!service_) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 it != observers_.end(); ++it) { 58 it != observers_.end(); ++it) {
55 service_->RemovePrefObserver(it->first.c_str(), it->second); 59 service_->RemovePrefObserver(it->first.c_str(), it->second);
56 } 60 }
57 observers_.clear(); 61 observers_.clear();
58 } 62 }
59 } 63 }
60 64
61 bool PrefChangeRegistrar::IsEmpty() const { 65 bool PrefChangeRegistrar::IsEmpty() const {
62 return observers_.empty(); 66 return observers_.empty();
63 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698