OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/sync/profile_sync_service.h" | 8 #include "chrome/browser/sync/profile_sync_service.h" |
9 #include "chrome/browser/views/options/options_page_view.h" | 9 #include "chrome/browser/views/options/options_page_view.h" |
10 #include "chrome/browser/views/confirm_message_box_dialog.h" | 10 #include "chrome/browser/views/confirm_message_box_dialog.h" |
11 #include "chrome/common/pref_member.h" | 11 #include "chrome/common/pref_member.h" |
12 #include "views/controls/button/button.h" | 12 #include "views/controls/button/button.h" |
13 #include "views/controls/link.h" | 13 #include "views/controls/link.h" |
14 #include "views/view.h" | 14 #include "views/view.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class Checkbox; | 17 class Checkbox; |
18 class Label; | 18 class Label; |
19 class NativeButton; | 19 class NativeButton; |
20 class RadioButton; | 20 class RadioButton; |
21 } | 21 } |
22 class FileDisplayArea; | 22 class FileDisplayArea; |
23 class OptionsGroupView; | 23 class OptionsGroupView; |
24 class PrefService; | 24 class PrefService; |
25 | 25 |
26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
27 // ContentPageView | 27 // ContentPageView |
28 | 28 |
29 class ContentPageView : public OptionsPageView, | 29 class ContentPageView : public OptionsPageView, |
30 #if defined(BROWSER_SYNC) | |
31 public views::LinkController, | 30 public views::LinkController, |
32 public ProfileSyncServiceObserver, | 31 public ProfileSyncServiceObserver, |
33 #endif | |
34 public views::ButtonListener, | 32 public views::ButtonListener, |
35 public ConfirmMessageBoxObserver { | 33 public ConfirmMessageBoxObserver { |
36 public: | 34 public: |
37 explicit ContentPageView(Profile* profile); | 35 explicit ContentPageView(Profile* profile); |
38 virtual ~ContentPageView(); | 36 virtual ~ContentPageView(); |
39 | 37 |
40 // views::ButtonListener implementation: | 38 // views::ButtonListener implementation: |
41 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 39 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
42 | 40 |
43 // views::LinkController method. | 41 // views::LinkController method. |
44 virtual void LinkActivated(views::Link* source, int event_flags); | 42 virtual void LinkActivated(views::Link* source, int event_flags); |
45 | 43 |
46 // ConfirmMessageBoxObserver implementation. | 44 // ConfirmMessageBoxObserver implementation. |
47 virtual void OnConfirmMessageAccept(); | 45 virtual void OnConfirmMessageAccept(); |
48 | 46 |
49 #if defined(BROWSER_SYNC) | |
50 // ProfileSyncServiceObserver method. | 47 // ProfileSyncServiceObserver method. |
51 virtual void OnStateChanged(); | 48 virtual void OnStateChanged(); |
52 #endif | |
53 | 49 |
54 protected: | 50 protected: |
55 // OptionsPageView implementation: | 51 // OptionsPageView implementation: |
56 virtual void InitControlLayout(); | 52 virtual void InitControlLayout(); |
57 virtual void NotifyPrefChanged(const std::wstring* pref_name); | 53 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
58 | 54 |
59 // views::View overrides: | 55 // views::View overrides: |
60 virtual void Layout(); | 56 virtual void Layout(); |
61 | 57 |
62 private: | 58 private: |
63 #if defined(BROWSER_SYNC) | |
64 // Updates various sync controls based on the current sync state. | 59 // Updates various sync controls based on the current sync state. |
65 void UpdateSyncControls(); | 60 void UpdateSyncControls(); |
66 | 61 |
67 // Returns whether initialization of controls is done or not. | 62 // Returns whether initialization of controls is done or not. |
68 bool is_initialized() const { | 63 bool is_initialized() const { |
69 // If initialization is already done, all the UI controls data members | 64 // If initialization is already done, all the UI controls data members |
70 // should be non-NULL. So check for one of them to determine if controls | 65 // should be non-NULL. So check for one of them to determine if controls |
71 // are already initialized or not. | 66 // are already initialized or not. |
72 return sync_group_ != NULL; | 67 return sync_group_ != NULL; |
73 } | 68 } |
74 #endif | |
75 | 69 |
76 // Init all the dialog controls. | 70 // Init all the dialog controls. |
77 void InitPasswordSavingGroup(); | 71 void InitPasswordSavingGroup(); |
78 void InitFormAutofillGroup(); | 72 void InitFormAutofillGroup(); |
79 void InitBrowsingDataGroup(); | 73 void InitBrowsingDataGroup(); |
80 void InitThemesGroup(); | 74 void InitThemesGroup(); |
81 #if defined(BROWSER_SYNC) | |
82 void InitSyncGroup(); | 75 void InitSyncGroup(); |
83 #endif | |
84 | 76 |
85 // Controls for the Password Saving group | 77 // Controls for the Password Saving group |
86 views::NativeButton* passwords_exceptions_button_; | 78 views::NativeButton* passwords_exceptions_button_; |
87 OptionsGroupView* passwords_group_; | 79 OptionsGroupView* passwords_group_; |
88 views::RadioButton* passwords_asktosave_radio_; | 80 views::RadioButton* passwords_asktosave_radio_; |
89 views::RadioButton* passwords_neversave_radio_; | 81 views::RadioButton* passwords_neversave_radio_; |
90 | 82 |
91 // Controls for the Form Autofill group | 83 // Controls for the Form Autofill group |
92 OptionsGroupView* form_autofill_group_; | 84 OptionsGroupView* form_autofill_group_; |
93 views::RadioButton* form_autofill_asktosave_radio_; | 85 views::RadioButton* form_autofill_asktosave_radio_; |
94 views::RadioButton* form_autofill_neversave_radio_; | 86 views::RadioButton* form_autofill_neversave_radio_; |
95 | 87 |
96 // Controls for the Themes group | 88 // Controls for the Themes group |
97 OptionsGroupView* themes_group_; | 89 OptionsGroupView* themes_group_; |
98 views::NativeButton* themes_reset_button_; | 90 views::NativeButton* themes_reset_button_; |
99 views::Link* themes_gallery_link_; | 91 views::Link* themes_gallery_link_; |
100 | 92 |
101 // Controls for the browsing data group. | 93 // Controls for the browsing data group. |
102 OptionsGroupView* browsing_data_group_; | 94 OptionsGroupView* browsing_data_group_; |
103 views::Label* browsing_data_label_; | 95 views::Label* browsing_data_label_; |
104 views::NativeButton* import_button_; | 96 views::NativeButton* import_button_; |
105 views::NativeButton* clear_data_button_; | 97 views::NativeButton* clear_data_button_; |
106 | 98 |
107 #if defined(BROWSER_SYNC) | |
108 // Controls for the Sync group. | 99 // Controls for the Sync group. |
109 OptionsGroupView* sync_group_; | 100 OptionsGroupView* sync_group_; |
110 views::Label* sync_status_label_; | 101 views::Label* sync_status_label_; |
111 views::Link* sync_action_link_; | 102 views::Link* sync_action_link_; |
112 views::NativeButton* sync_start_stop_button_; | 103 views::NativeButton* sync_start_stop_button_; |
113 #endif | |
114 | 104 |
115 BooleanPrefMember ask_to_save_passwords_; | 105 BooleanPrefMember ask_to_save_passwords_; |
116 BooleanPrefMember ask_to_save_form_autofill_; | 106 BooleanPrefMember ask_to_save_form_autofill_; |
117 StringPrefMember is_using_default_theme_; | 107 StringPrefMember is_using_default_theme_; |
118 | 108 |
119 #if defined(BROWSER_SYNC) | |
120 // Cached pointer to ProfileSyncService, if it exists. Kept up to date | 109 // Cached pointer to ProfileSyncService, if it exists. Kept up to date |
121 // and NULL-ed out on destruction. | 110 // and NULL-ed out on destruction. |
122 ProfileSyncService* sync_service_; | 111 ProfileSyncService* sync_service_; |
123 #endif | |
124 | 112 |
125 DISALLOW_COPY_AND_ASSIGN(ContentPageView); | 113 DISALLOW_COPY_AND_ASSIGN(ContentPageView); |
126 }; | 114 }; |
127 | 115 |
128 #endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_ | 116 #endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H_ |
OLD | NEW |