| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/options/content_page_gtk.h" | 5 #include "chrome/browser/gtk/options/content_page_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/gtk_util.h" | 9 #include "app/gtk_util.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 #endif | 80 #endif |
| 81 sync_customize_button_(NULL), | 81 sync_customize_button_(NULL), |
| 82 initializing_(true), | 82 initializing_(true), |
| 83 sync_service_(NULL) { | 83 sync_service_(NULL) { |
| 84 if (profile->GetProfileSyncService()) { | 84 if (profile->GetProfileSyncService()) { |
| 85 sync_service_ = profile->GetProfileSyncService(); | 85 sync_service_ = profile->GetProfileSyncService(); |
| 86 sync_service_->AddObserver(this); | 86 sync_service_->AddObserver(this); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Prepare the group options layout. | 89 // Prepare the group options layout. |
| 90 OptionsLayoutBuilderGtk options_builder; | 90 scoped_ptr<OptionsLayoutBuilderGtk> |
| 91 options_builder(OptionsLayoutBuilderGtk::CreateOptionallyCompactLayout()); |
| 91 if (sync_service_) { | 92 if (sync_service_) { |
| 92 options_builder.AddOptionGroup( | 93 options_builder->AddOptionGroup( |
| 93 l10n_util::GetStringUTF8(IDS_SYNC_OPTIONS_GROUP_NAME), | 94 l10n_util::GetStringUTF8(IDS_SYNC_OPTIONS_GROUP_NAME), |
| 94 InitSyncGroup(), false); | 95 InitSyncGroup(), false); |
| 95 UpdateSyncControls(); | 96 UpdateSyncControls(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 options_builder.AddOptionGroup( | 99 options_builder->AddOptionGroup( |
| 99 l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_GROUP_NAME), | 100 l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_GROUP_NAME), |
| 100 InitPasswordSavingGroup(), false); | 101 InitPasswordSavingGroup(), false); |
| 101 options_builder.AddOptionGroup( | 102 options_builder->AddOptionGroup( |
| 102 l10n_util::GetStringUTF8(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), | 103 l10n_util::GetStringUTF8(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), |
| 103 InitFormAutoFillGroup(), false); | 104 InitFormAutoFillGroup(), false); |
| 104 options_builder.AddOptionGroup( | 105 options_builder->AddOptionGroup( |
| 105 l10n_util::GetStringUTF8(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME), | 106 l10n_util::GetStringUTF8(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME), |
| 106 InitBrowsingDataGroup(), false); | 107 InitBrowsingDataGroup(), false); |
| 107 options_builder.AddOptionGroup( | 108 options_builder->AddOptionGroup( |
| 108 l10n_util::GetStringUTF8(IDS_APPEARANCE_GROUP_NAME), | 109 l10n_util::GetStringUTF8(IDS_APPEARANCE_GROUP_NAME), |
| 109 InitThemesGroup(), false); | 110 InitThemesGroup(), false); |
| 110 page_ = options_builder.get_page_widget(); | 111 page_ = options_builder->get_page_widget(); |
| 111 | 112 |
| 112 // Add preferences observers. | 113 // Add preferences observers. |
| 113 ask_to_save_passwords_.Init(prefs::kPasswordManagerEnabled, | 114 ask_to_save_passwords_.Init(prefs::kPasswordManagerEnabled, |
| 114 profile->GetPrefs(), this); | 115 profile->GetPrefs(), this); |
| 115 enable_form_autofill_.Init(prefs::kAutoFillEnabled, | 116 enable_form_autofill_.Init(prefs::kAutoFillEnabled, |
| 116 profile->GetPrefs(), this); | 117 profile->GetPrefs(), this); |
| 117 | 118 |
| 118 if (browser_defaults::kCanToggleSystemTitleBar) { | 119 if (browser_defaults::kCanToggleSystemTitleBar) { |
| 119 use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame, | 120 use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame, |
| 120 profile->GetPrefs(), this); | 121 profile->GetPrefs(), this); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 sync_service_->ShowLoginDialog(); | 611 sync_service_->ShowLoginDialog(); |
| 611 } | 612 } |
| 612 | 613 |
| 613 void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { | 614 void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { |
| 614 if (response == GTK_RESPONSE_ACCEPT) { | 615 if (response == GTK_RESPONSE_ACCEPT) { |
| 615 sync_service_->DisableForUser(); | 616 sync_service_->DisableForUser(); |
| 616 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 617 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
| 617 } | 618 } |
| 618 gtk_widget_destroy(widget); | 619 gtk_widget_destroy(widget); |
| 619 } | 620 } |
| OLD | NEW |