Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: chrome/browser/gtk/options/content_page_gtk.cc

Issue 2847072: Green Tree Tactical Force: Revert skrul's bad commits (probably a git-cl bug). (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 /////////////////////////////////////////////////////////////////////////////// 68 ///////////////////////////////////////////////////////////////////////////////
69 // ContentPageGtk, public: 69 // ContentPageGtk, public:
70 70
71 ContentPageGtk::ContentPageGtk(Profile* profile) 71 ContentPageGtk::ContentPageGtk(Profile* profile)
72 : OptionsPageBase(profile), 72 : OptionsPageBase(profile),
73 sync_status_label_background_(NULL), 73 sync_status_label_background_(NULL),
74 sync_status_label_(NULL), 74 sync_status_label_(NULL),
75 #if !defined(OS_CHROMEOS) 75 #if !defined(OS_CHROMEOS)
76 sync_action_link_background_(NULL), 76 sync_action_link_background_(NULL),
77 sync_action_link_(NULL), 77 sync_action_link_(NULL),
78 sync_start_stop_button_(NULL),
78 #endif 79 #endif
79 sync_start_stop_button_(NULL),
80 sync_customize_button_(NULL), 80 sync_customize_button_(NULL),
81 privacy_dashboard_link_(NULL), 81 privacy_dashboard_link_(NULL),
82 initializing_(true), 82 initializing_(true),
83 sync_service_(NULL), 83 sync_service_(NULL),
84 managed_prefs_banner_(profile->GetPrefs(), OPTIONS_PAGE_CONTENT) { 84 managed_prefs_banner_(profile->GetPrefs(), OPTIONS_PAGE_CONTENT) {
85 if (profile->GetProfileSyncService()) { 85 if (profile->GetProfileSyncService()) {
86 sync_service_ = profile->GetProfileSyncService(); 86 sync_service_ = profile->GetProfileSyncService();
87 sync_service_->AddObserver(this); 87 sync_service_->AddObserver(this);
88 } 88 }
89 89
(...skipping 15 matching lines...) Expand all
105 use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame, 105 use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame,
106 profile->GetPrefs(), this); 106 profile->GetPrefs(), this);
107 } 107 }
108 108
109 options_builder->AddOptionGroup( 109 options_builder->AddOptionGroup(
110 l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_GROUP_NAME), 110 l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_GROUP_NAME),
111 InitPasswordSavingGroup(), false); 111 InitPasswordSavingGroup(), false);
112 options_builder->AddOptionGroup( 112 options_builder->AddOptionGroup(
113 l10n_util::GetStringUTF8(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), 113 l10n_util::GetStringUTF8(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME),
114 InitFormAutoFillGroup(), false); 114 InitFormAutoFillGroup(), false);
115 #if !defined(OS_CHROMEOS)
115 options_builder->AddOptionGroup( 116 options_builder->AddOptionGroup(
116 l10n_util::GetStringUTF8(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME), 117 l10n_util::GetStringUTF8(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME),
117 InitBrowsingDataGroup(), false); 118 InitBrowsingDataGroup(), false);
119 #endif
118 options_builder->AddOptionGroup( 120 options_builder->AddOptionGroup(
119 l10n_util::GetStringUTF8(IDS_APPEARANCE_GROUP_NAME), 121 l10n_util::GetStringUTF8(IDS_APPEARANCE_GROUP_NAME),
120 InitThemesGroup(), false); 122 InitThemesGroup(), false);
121 page_ = options_builder->get_page_widget(); 123 page_ = options_builder->get_page_widget();
122 124
123 // Load initial values. 125 // Load initial values.
124 NotifyPrefChanged(NULL); 126 NotifyPrefChanged(NULL);
125 127
126 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 128 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
127 NotificationService::AllSources()); 129 NotificationService::AllSources());
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 FALSE, 0); 351 FALSE, 0);
350 gtk_container_add(GTK_CONTAINER(sync_action_link_background_), 352 gtk_container_add(GTK_CONTAINER(sync_action_link_background_),
351 sync_action_link_); 353 sync_action_link_);
352 gtk_widget_hide(sync_action_link_background_); 354 gtk_widget_hide(sync_action_link_background_);
353 #endif 355 #endif
354 356
355 // Add the sync button into its own horizontal box so it does not 357 // Add the sync button into its own horizontal box so it does not
356 // depend on the spacing above. 358 // depend on the spacing above.
357 GtkWidget* button_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing); 359 GtkWidget* button_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing);
358 gtk_container_add(GTK_CONTAINER(vbox), button_hbox); 360 gtk_container_add(GTK_CONTAINER(vbox), button_hbox);
361 #if !defined(OS_CHROMEOS)
359 sync_start_stop_button_ = gtk_button_new_with_label(""); 362 sync_start_stop_button_ = gtk_button_new_with_label("");
360 g_signal_connect(sync_start_stop_button_, "clicked", 363 g_signal_connect(sync_start_stop_button_, "clicked",
361 G_CALLBACK(OnSyncStartStopButtonClickedThunk), this); 364 G_CALLBACK(OnSyncStartStopButtonClickedThunk), this);
362 gtk_box_pack_start(GTK_BOX(button_hbox), sync_start_stop_button_, FALSE, 365 gtk_box_pack_start(GTK_BOX(button_hbox), sync_start_stop_button_, FALSE,
363 FALSE, 0); 366 FALSE, 0);
367 #endif
364 sync_customize_button_ = gtk_button_new_with_label(""); 368 sync_customize_button_ = gtk_button_new_with_label("");
365 g_signal_connect(sync_customize_button_, "clicked", 369 g_signal_connect(sync_customize_button_, "clicked",
366 G_CALLBACK(OnSyncCustomizeButtonClickedThunk), this); 370 G_CALLBACK(OnSyncCustomizeButtonClickedThunk), this);
367 gtk_box_pack_start(GTK_BOX(button_hbox), sync_customize_button_, FALSE, 371 gtk_box_pack_start(GTK_BOX(button_hbox), sync_customize_button_, FALSE,
368 FALSE, 0); 372 FALSE, 0);
369 373
370 // Add the privacy dashboard link. Only show it if the command line 374 // Add the privacy dashboard link. Only show it if the command line
371 // switch has been provided. 375 // switch has been provided.
372 if (CommandLine::ForCurrentProcess()->HasSwitch( 376 if (CommandLine::ForCurrentProcess()->HasSwitch(
373 switches::kShowPrivacyDashboardLink)) { 377 switches::kShowPrivacyDashboardLink)) {
(...skipping 14 matching lines...) Expand all
388 } 392 }
389 393
390 return vbox; 394 return vbox;
391 } 395 }
392 396
393 void ContentPageGtk::UpdateSyncControls() { 397 void ContentPageGtk::UpdateSyncControls() {
394 DCHECK(sync_service_); 398 DCHECK(sync_service_);
395 string16 status_label; 399 string16 status_label;
396 string16 link_label; 400 string16 link_label;
397 std::string customize_button_label; 401 std::string customize_button_label;
402 std::string button_label;
398 bool managed = sync_service_->IsManaged(); 403 bool managed = sync_service_->IsManaged();
399 bool sync_setup_completed = sync_service_->HasSyncSetupCompleted(); 404 bool sync_setup_completed = sync_service_->HasSyncSetupCompleted();
400 bool status_has_error = sync_ui_util::GetStatusLabels(sync_service_, 405 bool status_has_error = sync_ui_util::GetStatusLabels(sync_service_,
401 &status_label, &link_label) == sync_ui_util::SYNC_ERROR; 406 &status_label, &link_label) == sync_ui_util::SYNC_ERROR;
402 customize_button_label = 407 customize_button_label =
403 l10n_util::GetStringUTF8(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL); 408 l10n_util::GetStringUTF8(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL);
404
405 std::string start_stop_button_label;
406 bool is_start_stop_button_visible = false;
407 bool is_start_stop_button_sensitive = false;
408 if (sync_setup_completed) { 409 if (sync_setup_completed) {
409 start_stop_button_label = 410 button_label = l10n_util::GetStringUTF8(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
410 l10n_util::GetStringUTF8(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
411 #if defined(OS_CHROMEOS)
412 is_start_stop_button_visible = false;
413 #else
414 is_start_stop_button_visible = true;
415 #endif
416 is_start_stop_button_sensitive = !managed;
417 } else if (sync_service_->SetupInProgress()) { 411 } else if (sync_service_->SetupInProgress()) {
418 start_stop_button_label = 412 button_label = l10n_util::GetStringUTF8(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
419 l10n_util::GetStringUTF8(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
420 is_start_stop_button_visible = true;
421 is_start_stop_button_sensitive = false;
422 } else { 413 } else {
423 start_stop_button_label = 414 button_label = l10n_util::GetStringUTF8(IDS_SYNC_START_SYNC_BUTTON_LABEL);
424 l10n_util::GetStringUTF8(IDS_SYNC_START_SYNC_BUTTON_LABEL);
425 is_start_stop_button_visible = true;
426 is_start_stop_button_sensitive = !managed;
427 } 415 }
428 gtk_widget_set_no_show_all(sync_start_stop_button_,
429 !is_start_stop_button_visible);
430 if (is_start_stop_button_visible)
431 gtk_widget_show(sync_start_stop_button_);
432 else
433 gtk_widget_hide(sync_start_stop_button_);
434 gtk_widget_set_sensitive(sync_start_stop_button_,
435 is_start_stop_button_sensitive);
436 gtk_button_set_label(GTK_BUTTON(sync_start_stop_button_),
437 start_stop_button_label.c_str());
438 416
439 gtk_label_set_label(GTK_LABEL(sync_status_label_), 417 gtk_label_set_label(GTK_LABEL(sync_status_label_),
440 UTF16ToUTF8(status_label).c_str()); 418 UTF16ToUTF8(status_label).c_str());
419 #if !defined(OS_CHROMEOS)
420 gtk_widget_set_sensitive(sync_start_stop_button_,
421 !sync_service_->WizardIsVisible() && !managed);
422 gtk_button_set_label(GTK_BUTTON(sync_start_stop_button_),
423 button_label.c_str());
424 #endif
441 425
442 gtk_widget_set_child_visible(sync_customize_button_, 426 gtk_widget_set_child_visible(sync_customize_button_,
443 sync_setup_completed && !status_has_error); 427 sync_setup_completed && !status_has_error);
444 gtk_button_set_label(GTK_BUTTON(sync_customize_button_), 428 gtk_button_set_label(GTK_BUTTON(sync_customize_button_),
445 customize_button_label.c_str()); 429 customize_button_label.c_str());
446 gtk_widget_set_sensitive(sync_customize_button_, !managed); 430 gtk_widget_set_sensitive(sync_customize_button_, !managed);
447 #if !defined(OS_CHROMEOS) 431 #if !defined(OS_CHROMEOS)
448 gtk_chrome_link_button_set_label(GTK_CHROME_LINK_BUTTON(sync_action_link_), 432 gtk_chrome_link_button_set_label(GTK_CHROME_LINK_BUTTON(sync_action_link_),
449 UTF16ToUTF8(link_label).c_str()); 433 UTF16ToUTF8(link_label).c_str());
450 if (link_label.empty()) { 434 if (link_label.empty()) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 if (response == GTK_RESPONSE_ACCEPT) { 593 if (response == GTK_RESPONSE_ACCEPT) {
610 sync_service_->DisableForUser(); 594 sync_service_->DisableForUser();
611 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); 595 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
612 } 596 }
613 gtk_widget_destroy(widget); 597 gtk_widget_destroy(widget);
614 } 598 }
615 599
616 void ContentPageGtk::OnPrivacyDashboardLinkClicked(GtkWidget* widget) { 600 void ContentPageGtk::OnPrivacyDashboardLinkClicked(GtkWidget* widget) {
617 BrowserList::GetLastActive()->OpenPrivacyDashboardTabAndActivate(); 601 BrowserList::GetLastActive()->OpenPrivacyDashboardTabAndActivate();
618 } 602 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/content_page_gtk.h ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698