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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/pref_member.h ('k') | chrome/browser/prefs/pref_member_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_member.h" 5 #include "chrome/browser/prefs/pref_member.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/value_conversions.h" 8 #include "base/value_conversions.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "content/common/notification_type.h" 10 #include "chrome/common/chrome_notification_types.h"
11 11
12 namespace subtle { 12 namespace subtle {
13 13
14 PrefMemberBase::PrefMemberBase() 14 PrefMemberBase::PrefMemberBase()
15 : observer_(NULL), 15 : observer_(NULL),
16 prefs_(NULL), 16 prefs_(NULL),
17 setting_value_(false) { 17 setting_value_(false) {
18 } 18 }
19 19
20 PrefMemberBase::~PrefMemberBase() { 20 PrefMemberBase::~PrefMemberBase() {
(...skipping 23 matching lines...) Expand all
44 } 44 }
45 45
46 void PrefMemberBase::MoveToThread(BrowserThread::ID thread_id) { 46 void PrefMemberBase::MoveToThread(BrowserThread::ID thread_id) {
47 VerifyValuePrefName(); 47 VerifyValuePrefName();
48 // Load the value from preferences if it hasn't been loaded so far. 48 // Load the value from preferences if it hasn't been loaded so far.
49 if (!internal()) 49 if (!internal())
50 UpdateValueFromPref(); 50 UpdateValueFromPref();
51 internal()->MoveToThread(thread_id); 51 internal()->MoveToThread(thread_id);
52 } 52 }
53 53
54 void PrefMemberBase::Observe(NotificationType type, 54 void PrefMemberBase::Observe(int type,
55 const NotificationSource& source, 55 const NotificationSource& source,
56 const NotificationDetails& details) { 56 const NotificationDetails& details) {
57 VerifyValuePrefName(); 57 VerifyValuePrefName();
58 DCHECK(NotificationType::PREF_CHANGED == type); 58 DCHECK(chrome::NOTIFICATION_PREF_CHANGED == type);
59 UpdateValueFromPref(); 59 UpdateValueFromPref();
60 if (!setting_value_ && observer_) 60 if (!setting_value_ && observer_)
61 observer_->Observe(type, source, details); 61 observer_->Observe(type, source, details);
62 } 62 }
63 63
64 void PrefMemberBase::UpdateValueFromPref() const { 64 void PrefMemberBase::UpdateValueFromPref() const {
65 VerifyValuePrefName(); 65 VerifyValuePrefName();
66 const PrefService::Preference* pref = 66 const PrefService::Preference* pref =
67 prefs_->FindPreference(pref_name_.c_str()); 67 prefs_->FindPreference(pref_name_.c_str());
68 DCHECK(pref); 68 DCHECK(pref);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 template <> 158 template <>
159 void PrefMember<FilePath>::UpdatePref(const FilePath& value) { 159 void PrefMember<FilePath>::UpdatePref(const FilePath& value) {
160 prefs()->SetFilePath(pref_name().c_str(), value); 160 prefs()->SetFilePath(pref_name().c_str(), value);
161 } 161 }
162 162
163 template <> 163 template <>
164 bool PrefMember<FilePath>::Internal::UpdateValueInternal(const Value& value) 164 bool PrefMember<FilePath>::Internal::UpdateValueInternal(const Value& value)
165 const { 165 const {
166 return base::GetValueAsFilePath(value, &value_); 166 return base::GetValueAsFilePath(value, &value_);
167 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_member.h ('k') | chrome/browser/prefs/pref_member_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698