| 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_GTK_OPTIONS_CONTENT_PAGE_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_ | 6 #define CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "chrome/browser/autofill/personal_data_manager.h" |
| 10 #include "chrome/browser/options_page_base.h" | 11 #include "chrome/browser/options_page_base.h" |
| 11 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
| 12 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
| 13 #include "chrome/common/pref_member.h" | 14 #include "chrome/common/pref_member.h" |
| 14 | 15 |
| 15 class ContentPageGtk : public OptionsPageBase, | 16 class ContentPageGtk : public OptionsPageBase, |
| 16 public ProfileSyncServiceObserver { | 17 public ProfileSyncServiceObserver, |
| 18 public PersonalDataManager::Observer { |
| 17 public: | 19 public: |
| 18 explicit ContentPageGtk(Profile* profile); | 20 explicit ContentPageGtk(Profile* profile); |
| 19 ~ContentPageGtk(); | 21 ~ContentPageGtk(); |
| 20 | 22 |
| 21 GtkWidget* get_page_widget() const { | 23 GtkWidget* get_page_widget() const { |
| 22 return page_; | 24 return page_; |
| 23 } | 25 } |
| 24 | 26 |
| 25 // ProfileSyncServiceObserver method. | 27 // ProfileSyncServiceObserver method. |
| 26 virtual void OnStateChanged(); | 28 virtual void OnStateChanged(); |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 // Updates various sync controls based on the current sync state. | 31 // Updates various sync controls based on the current sync state. |
| 30 void UpdateSyncControls(); | 32 void UpdateSyncControls(); |
| 31 | 33 |
| 32 // Overridden from OptionsPageBase. | 34 // Overridden from OptionsPageBase. |
| 33 virtual void NotifyPrefChanged(const std::wstring* pref_name); | 35 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
| 34 | 36 |
| 35 // Overridden from OptionsPageBase. | 37 // Overridden from OptionsPageBase. |
| 36 virtual void Observe(NotificationType type, | 38 virtual void Observe(NotificationType type, |
| 37 const NotificationSource& source, | 39 const NotificationSource& source, |
| 38 const NotificationDetails& details); | 40 const NotificationDetails& details); |
| 39 | 41 |
| 42 // Overriden from PersonalDataManager::Observer. |
| 43 virtual void OnPersonalDataLoaded(); |
| 44 |
| 40 // Update content area after a theme changed. | 45 // Update content area after a theme changed. |
| 41 void ObserveThemeChanged(); | 46 void ObserveThemeChanged(); |
| 42 | 47 |
| 43 // Initialize the option group widgets, return their container. | 48 // Initialize the option group widgets, return their container. |
| 44 GtkWidget* InitPasswordSavingGroup(); | 49 GtkWidget* InitPasswordSavingGroup(); |
| 45 GtkWidget* InitFormAutofillGroup(); | 50 GtkWidget* InitFormAutofillGroup(); |
| 46 GtkWidget* InitBrowsingDataGroup(); | 51 GtkWidget* InitBrowsingDataGroup(); |
| 47 GtkWidget* InitThemesGroup(); | 52 GtkWidget* InitThemesGroup(); |
| 48 GtkWidget* InitSyncGroup(); | 53 GtkWidget* InitSyncGroup(); |
| 49 | 54 |
| 55 // Callback for autofill button. |
| 56 static void OnAutoFillButtonClicked(GtkButton* widget, ContentPageGtk* page); |
| 57 |
| 50 // Callback for import button. | 58 // Callback for import button. |
| 51 static void OnImportButtonClicked(GtkButton* widget, ContentPageGtk* page); | 59 static void OnImportButtonClicked(GtkButton* widget, ContentPageGtk* page); |
| 52 | 60 |
| 53 // Callback for the GTK theme button. | 61 // Callback for the GTK theme button. |
| 54 static void OnGtkThemeButtonClicked(GtkButton* widget, | 62 static void OnGtkThemeButtonClicked(GtkButton* widget, |
| 55 ContentPageGtk* page); | 63 ContentPageGtk* page); |
| 56 | 64 |
| 57 // Callback for reset default theme button. | 65 // Callback for reset default theme button. |
| 58 static void OnResetDefaultThemeButtonClicked(GtkButton* widget, | 66 static void OnResetDefaultThemeButtonClicked(GtkButton* widget, |
| 59 ContentPageGtk* page); | 67 ContentPageGtk* page); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 // Callback for stop sync dialog. | 97 // Callback for stop sync dialog. |
| 90 static void OnStopSyncDialogResponse(GtkWidget* widget, | 98 static void OnStopSyncDialogResponse(GtkWidget* widget, |
| 91 int response, | 99 int response, |
| 92 ContentPageGtk* page); | 100 ContentPageGtk* page); |
| 93 | 101 |
| 94 // Widgets for the Password saving group. | 102 // Widgets for the Password saving group. |
| 95 GtkWidget* passwords_asktosave_radio_; | 103 GtkWidget* passwords_asktosave_radio_; |
| 96 GtkWidget* passwords_neversave_radio_; | 104 GtkWidget* passwords_neversave_radio_; |
| 97 | 105 |
| 98 // Widgets for the Form Autofill group. | 106 // Widgets for the Form Autofill group. |
| 99 GtkWidget* form_autofill_asktosave_radio_; | 107 GtkWidget* form_autofill_enable_radio_; |
| 100 GtkWidget* form_autofill_neversave_radio_; | 108 GtkWidget* form_autofill_disable_radio_; |
| 101 | 109 |
| 102 // Widgets for the Appearance group. | 110 // Widgets for the Appearance group. |
| 103 GtkWidget* system_title_bar_show_radio_; | 111 GtkWidget* system_title_bar_show_radio_; |
| 104 GtkWidget* system_title_bar_hide_radio_; | 112 GtkWidget* system_title_bar_hide_radio_; |
| 105 GtkWidget* themes_reset_button_; | 113 GtkWidget* themes_reset_button_; |
| 106 #if defined(TOOLKIT_GTK) | 114 #if defined(TOOLKIT_GTK) |
| 107 GtkWidget* gtk_theme_button_; | 115 GtkWidget* gtk_theme_button_; |
| 108 #endif | 116 #endif |
| 109 | 117 |
| 110 // Widgets for the Sync group. | 118 // Widgets for the Sync group. |
| 111 GtkWidget* sync_status_label_background_; | 119 GtkWidget* sync_status_label_background_; |
| 112 GtkWidget* sync_status_label_; | 120 GtkWidget* sync_status_label_; |
| 113 GtkWidget* sync_action_link_background_; | 121 GtkWidget* sync_action_link_background_; |
| 114 GtkWidget* sync_action_link_; | 122 GtkWidget* sync_action_link_; |
| 115 GtkWidget* sync_start_stop_button_; | 123 GtkWidget* sync_start_stop_button_; |
| 116 | 124 |
| 117 // The parent GtkTable widget | 125 // The parent GtkTable widget |
| 118 GtkWidget* page_; | 126 GtkWidget* page_; |
| 119 | 127 |
| 120 // Pref members. | 128 // Pref members. |
| 121 BooleanPrefMember ask_to_save_passwords_; | 129 BooleanPrefMember ask_to_save_passwords_; |
| 122 BooleanPrefMember ask_to_save_form_autofill_; | 130 BooleanPrefMember enable_form_autofill_; |
| 123 BooleanPrefMember use_custom_chrome_frame_; | 131 BooleanPrefMember use_custom_chrome_frame_; |
| 124 | 132 |
| 125 // Flag to ignore gtk callbacks while we are loading prefs, to avoid | 133 // Flag to ignore gtk callbacks while we are loading prefs, to avoid |
| 126 // then turning around and saving them again. | 134 // then turning around and saving them again. |
| 127 bool initializing_; | 135 bool initializing_; |
| 128 | 136 |
| 129 NotificationRegistrar registrar_; | 137 NotificationRegistrar registrar_; |
| 130 | 138 |
| 131 // Cached pointer to ProfileSyncService, if it exists. Kept up to date | 139 // Cached pointer to ProfileSyncService, if it exists. Kept up to date |
| 132 // and NULL-ed out on destruction. | 140 // and NULL-ed out on destruction. |
| 133 ProfileSyncService* sync_service_; | 141 ProfileSyncService* sync_service_; |
| 134 | 142 |
| 143 // The personal data manager, used to save and load personal data to/from the |
| 144 // web database. This can be NULL. |
| 145 PersonalDataManager* personal_data_; |
| 146 |
| 135 DISALLOW_COPY_AND_ASSIGN(ContentPageGtk); | 147 DISALLOW_COPY_AND_ASSIGN(ContentPageGtk); |
| 136 }; | 148 }; |
| 137 | 149 |
| 138 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_ | 150 #endif // CHROME_BROWSER_GTK_OPTIONS_CONTENT_PAGE_GTK_H_ |
| OLD | NEW |