| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 sync_start_stop_button_(NULL), |
| 79 #endif | 79 #endif |
| 80 sync_customize_button_(NULL), | 80 sync_customize_button_(NULL), |
| 81 privacy_dashboard_link_(NULL), |
| 81 initializing_(true), | 82 initializing_(true), |
| 82 sync_service_(NULL) { | 83 sync_service_(NULL) { |
| 83 if (profile->GetProfileSyncService()) { | 84 if (profile->GetProfileSyncService()) { |
| 84 sync_service_ = profile->GetProfileSyncService(); | 85 sync_service_ = profile->GetProfileSyncService(); |
| 85 sync_service_->AddObserver(this); | 86 sync_service_->AddObserver(this); |
| 86 } | 87 } |
| 87 | 88 |
| 88 // Prepare the group options layout. | 89 // Prepare the group options layout. |
| 89 scoped_ptr<OptionsLayoutBuilderGtk> | 90 scoped_ptr<OptionsLayoutBuilderGtk> |
| 90 options_builder(OptionsLayoutBuilderGtk::CreateOptionallyCompactLayout()); | 91 options_builder(OptionsLayoutBuilderGtk::CreateOptionallyCompactLayout()); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 G_CALLBACK(OnSyncStartStopButtonClickedThunk), this); | 387 G_CALLBACK(OnSyncStartStopButtonClickedThunk), this); |
| 387 gtk_box_pack_start(GTK_BOX(button_hbox), sync_start_stop_button_, FALSE, | 388 gtk_box_pack_start(GTK_BOX(button_hbox), sync_start_stop_button_, FALSE, |
| 388 FALSE, 0); | 389 FALSE, 0); |
| 389 #endif | 390 #endif |
| 390 sync_customize_button_ = gtk_button_new_with_label(""); | 391 sync_customize_button_ = gtk_button_new_with_label(""); |
| 391 g_signal_connect(sync_customize_button_, "clicked", | 392 g_signal_connect(sync_customize_button_, "clicked", |
| 392 G_CALLBACK(OnSyncCustomizeButtonClickedThunk), this); | 393 G_CALLBACK(OnSyncCustomizeButtonClickedThunk), this); |
| 393 gtk_box_pack_start(GTK_BOX(button_hbox), sync_customize_button_, FALSE, | 394 gtk_box_pack_start(GTK_BOX(button_hbox), sync_customize_button_, FALSE, |
| 394 FALSE, 0); | 395 FALSE, 0); |
| 395 | 396 |
| 397 // Add the privacy dashboard link. Only show it if the command line |
| 398 // switch has been provided. |
| 399 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 400 switches::kShowPrivacyDashboardLink)) { |
| 401 GtkWidget* dashboard_link_hbox = |
| 402 gtk_hbox_new(FALSE, gtk_util::kLabelSpacing); |
| 403 GtkWidget* dashboard_link_background = gtk_event_box_new(); |
| 404 std::string dashboard_link_label = |
| 405 l10n_util::GetStringUTF8(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL); |
| 406 privacy_dashboard_link_ = |
| 407 gtk_chrome_link_button_new(dashboard_link_label.c_str()); |
| 408 g_signal_connect(privacy_dashboard_link_, "clicked", |
| 409 G_CALLBACK(OnPrivacyDashboardLinkClickedThunk), this); |
| 410 gtk_box_pack_start(GTK_BOX(vbox), dashboard_link_hbox, FALSE, FALSE, 0); |
| 411 gtk_box_pack_start(GTK_BOX(dashboard_link_hbox), |
| 412 dashboard_link_background, FALSE, FALSE, 0); |
| 413 gtk_container_add(GTK_CONTAINER(dashboard_link_background), |
| 414 privacy_dashboard_link_); |
| 415 } |
| 416 |
| 396 return vbox; | 417 return vbox; |
| 397 } | 418 } |
| 398 | 419 |
| 399 void ContentPageGtk::UpdateSyncControls() { | 420 void ContentPageGtk::UpdateSyncControls() { |
| 400 DCHECK(sync_service_); | 421 DCHECK(sync_service_); |
| 401 string16 status_label; | 422 string16 status_label; |
| 402 string16 link_label; | 423 string16 link_label; |
| 403 std::string customize_button_label; | 424 std::string customize_button_label; |
| 404 std::string button_label; | 425 std::string button_label; |
| 405 bool sync_setup_completed = sync_service_->HasSyncSetupCompleted(); | 426 bool sync_setup_completed = sync_service_->HasSyncSetupCompleted(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 sync_service_->ShowLoginDialog(); | 632 sync_service_->ShowLoginDialog(); |
| 612 } | 633 } |
| 613 | 634 |
| 614 void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { | 635 void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { |
| 615 if (response == GTK_RESPONSE_ACCEPT) { | 636 if (response == GTK_RESPONSE_ACCEPT) { |
| 616 sync_service_->DisableForUser(); | 637 sync_service_->DisableForUser(); |
| 617 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 638 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
| 618 } | 639 } |
| 619 gtk_widget_destroy(widget); | 640 gtk_widget_destroy(widget); |
| 620 } | 641 } |
| 642 |
| 643 void ContentPageGtk::OnPrivacyDashboardLinkClicked(GtkWidget* widget) { |
| 644 BrowserList::GetLastActive()->OpenPrivacyDashboardTabAndActivate(); |
| 645 } |
| OLD | NEW |