summaryrefslogtreecommitdiffstats
path: root/chrome/browser/options_page_base.cc
blob: 6ee561013df723a0bfb4820767a8219ef61c53f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/options_page_base.h"

#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/notification_service.h"

///////////////////////////////////////////////////////////////////////////////
// OptionsPageBase

OptionsPageBase::OptionsPageBase(Profile* profile)
    : profile_(profile) {
}

OptionsPageBase::~OptionsPageBase() {
}

void OptionsPageBase::UserMetricsRecordAction(const UserMetricsAction& action,
                                              PrefService* prefs) {
  UserMetrics::RecordAction(action, profile());
  if (prefs)
    prefs->ScheduleSavePersistentPrefs();
}

///////////////////////////////////////////////////////////////////////////////
// OptionsPageBase, NotificationObserver implementation:

void OptionsPageBase::Observe(NotificationType type,
                              const NotificationSource& source,
                              const NotificationDetails& details) {
  if (type == NotificationType::PREF_CHANGED)
    NotifyPrefChanged(Details<std::string>(details).ptr());
}