OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/options/options_page_view.h" | 5 #include "chrome/browser/views/options/options_page_view.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/metrics/user_metrics.h" | 8 #include "chrome/browser/metrics/user_metrics.h" |
9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_service.h" |
10 #include "chrome/common/pref_service.h" | 10 #include "chrome/common/pref_service.h" |
11 #include "views/widget/widget.h" | 11 #include "views/widget/widget.h" |
12 | 12 |
13 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
14 // OptionsPageView | 14 // OptionsPageView |
15 | 15 |
16 OptionsPageView::OptionsPageView(Profile* profile) | 16 OptionsPageView::OptionsPageView(Profile* profile) |
17 : profile_(profile), | 17 : OptionsPageBase(profile), |
18 initialized_(false) { | 18 initialized_(false) { |
19 } | 19 } |
20 | 20 |
21 OptionsPageView::~OptionsPageView() { | 21 OptionsPageView::~OptionsPageView() { |
22 } | 22 } |
23 | 23 |
24 void OptionsPageView::UserMetricsRecordAction(const wchar_t* action, | |
25 PrefService* prefs) { | |
26 UserMetrics::RecordComputedAction(action, profile()); | |
27 if (prefs) | |
28 prefs->ScheduleSavePersistentPrefs(); | |
29 } | |
30 | |
31 /////////////////////////////////////////////////////////////////////////////// | |
32 // OptionsPageView, NotificationObserver implementation: | |
33 | |
34 void OptionsPageView::Observe(NotificationType type, | |
35 const NotificationSource& source, | |
36 const NotificationDetails& details) { | |
37 if (type == NotificationType::PREF_CHANGED) | |
38 NotifyPrefChanged(Details<std::wstring>(details).ptr()); | |
39 } | |
40 | |
41 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
42 // OptionsPageView, views::View overrides: | 25 // OptionsPageView, views::View overrides: |
43 | 26 |
44 void OptionsPageView::ViewHierarchyChanged(bool is_add, | 27 void OptionsPageView::ViewHierarchyChanged(bool is_add, |
45 views::View* parent, | 28 views::View* parent, |
46 views::View* child) { | 29 views::View* child) { |
47 if (!initialized_ && is_add && GetWidget()) { | 30 if (!initialized_ && is_add && GetWidget()) { |
48 // It is important that this only get done _once_ otherwise we end up | 31 // It is important that this only get done _once_ otherwise we end up |
49 // duplicating the view hierarchy when tabs are switched. | 32 // duplicating the view hierarchy when tabs are switched. |
50 initialized_ = true; | 33 initialized_ = true; |
51 InitControlLayout(); | 34 InitControlLayout(); |
52 NotifyPrefChanged(NULL); | 35 NotifyPrefChanged(NULL); |
53 } | 36 } |
54 } | 37 } |
OLD | NEW |