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 "chrome/views/widget/widget.h" | 11 #include "chrome/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 : profile_(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, | 24 void OptionsPageView::UserMetricsRecordAction(const wchar_t* action, |
25 PrefService* prefs) { | 25 PrefService* prefs) { |
26 UserMetrics::RecordComputedAction(action, profile()); | 26 UserMetrics::RecordComputedAction(action, profile()); |
27 if (prefs) | 27 if (prefs) |
28 prefs->ScheduleSavePersistentPrefs(g_browser_process->file_thread()); | 28 prefs->ScheduleSavePersistentPrefs(); |
29 } | 29 } |
30 | 30 |
31 /////////////////////////////////////////////////////////////////////////////// | 31 /////////////////////////////////////////////////////////////////////////////// |
32 // OptionsPageView, NotificationObserver implementation: | 32 // OptionsPageView, NotificationObserver implementation: |
33 | 33 |
34 void OptionsPageView::Observe(NotificationType type, | 34 void OptionsPageView::Observe(NotificationType type, |
35 const NotificationSource& source, | 35 const NotificationSource& source, |
36 const NotificationDetails& details) { | 36 const NotificationDetails& details) { |
37 if (type == NotificationType::PREF_CHANGED) | 37 if (type == NotificationType::PREF_CHANGED) |
38 NotifyPrefChanged(Details<std::wstring>(details).ptr()); | 38 NotifyPrefChanged(Details<std::wstring>(details).ptr()); |
(...skipping 12 matching lines...) Expand all Loading... |
51 InitControlLayout(); | 51 InitControlLayout(); |
52 NotifyPrefChanged(NULL); | 52 NotifyPrefChanged(NULL); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 HWND OptionsPageView::GetRootWindow() const { | 56 HWND OptionsPageView::GetRootWindow() const { |
57 // Our Widget is the TabbedPane content HWND, which is a child HWND. | 57 // Our Widget is the TabbedPane content HWND, which is a child HWND. |
58 // We need the root HWND for parenting. | 58 // We need the root HWND for parenting. |
59 return GetAncestor(GetWidget()->GetNativeView(), GA_ROOT); | 59 return GetAncestor(GetWidget()->GetNativeView(), GA_ROOT); |
60 } | 60 } |
OLD | NEW |