| OLD | NEW |
| 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/ui/options/options_page_base.h" | 5 #include "chrome/browser/ui/options/options_page_base.h" |
| 6 | 6 |
| 7 #include "chrome/browser/metrics/user_metrics.h" | 7 #include "chrome/browser/metrics/user_metrics.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_details.h" |
| 10 #include "chrome/common/notification_source.h" |
| 11 #include "chrome/common/notification_type.h" |
| 10 | 12 |
| 11 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
| 12 // OptionsPageBase | 14 // OptionsPageBase |
| 13 | 15 |
| 14 OptionsPageBase::OptionsPageBase(Profile* profile) | 16 OptionsPageBase::OptionsPageBase(Profile* profile) |
| 15 : profile_(profile) { | 17 : profile_(profile) { |
| 16 } | 18 } |
| 17 | 19 |
| 18 OptionsPageBase::~OptionsPageBase() { | 20 OptionsPageBase::~OptionsPageBase() { |
| 19 } | 21 } |
| 20 | 22 |
| 21 void OptionsPageBase::UserMetricsRecordAction(const UserMetricsAction& action, | 23 void OptionsPageBase::UserMetricsRecordAction(const UserMetricsAction& action, |
| 22 PrefService* prefs) { | 24 PrefService* prefs) { |
| 23 UserMetrics::RecordAction(action, profile()); | 25 UserMetrics::RecordAction(action, profile()); |
| 24 if (prefs) | 26 if (prefs) |
| 25 prefs->ScheduleSavePersistentPrefs(); | 27 prefs->ScheduleSavePersistentPrefs(); |
| 26 } | 28 } |
| 27 | 29 |
| 28 /////////////////////////////////////////////////////////////////////////////// | 30 /////////////////////////////////////////////////////////////////////////////// |
| 29 // OptionsPageBase, NotificationObserver implementation: | 31 // OptionsPageBase, NotificationObserver implementation: |
| 30 | 32 |
| 31 void OptionsPageBase::Observe(NotificationType type, | 33 void OptionsPageBase::Observe(NotificationType type, |
| 32 const NotificationSource& source, | 34 const NotificationSource& source, |
| 33 const NotificationDetails& details) { | 35 const NotificationDetails& details) { |
| 34 if (type == NotificationType::PREF_CHANGED) | 36 if (type == NotificationType::PREF_CHANGED) |
| 35 NotifyPrefChanged(Details<std::string>(details).ptr()); | 37 NotifyPrefChanged(Details<std::string>(details).ptr()); |
| 36 } | 38 } |
| OLD | NEW |