| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/options/content_page_gtk.h" | 5 #include "chrome/browser/ui/gtk/options/content_page_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/common/notification_service.h" | 24 #include "chrome/common/notification_service.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "gfx/gtk_util.h" | 27 #include "gfx/gtk_util.h" |
| 28 #include "grit/app_resources.h" | 28 #include "grit/app_resources.h" |
| 29 #include "grit/chromium_strings.h" | 29 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 31 #include "grit/locale_settings.h" | 31 #include "grit/locale_settings.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 33 | 33 |
| 34 #if defined(OS_CHROMEOS) | |
| 35 #include "chrome/browser/chromeos/options/options_window_view.h" | |
| 36 #endif // defined(OS_CHROMEOS) | |
| 37 | |
| 38 namespace { | 34 namespace { |
| 39 | 35 |
| 40 // Background color for the status label when it's showing an error. | 36 // Background color for the status label when it's showing an error. |
| 41 static const GdkColor kSyncLabelErrorBgColor = GDK_COLOR_RGB(0xff, 0x9a, 0x9a); | 37 static const GdkColor kSyncLabelErrorBgColor = GDK_COLOR_RGB(0xff, 0x9a, 0x9a); |
| 42 | 38 |
| 43 // Helper for WrapLabelAtAllocationHack. | 39 // Helper for WrapLabelAtAllocationHack. |
| 44 void OnLabelAllocate(GtkWidget* label, GtkAllocation* allocation) { | 40 void OnLabelAllocate(GtkWidget* label, GtkAllocation* allocation) { |
| 45 gtk_util::SetLabelWidth(label, allocation->width); | 41 gtk_util::SetLabelWidth(label, allocation->width); |
| 46 | 42 |
| 47 // Disconnect ourselves. Repeatedly resizing based on allocation causes | 43 // Disconnect ourselves. Repeatedly resizing based on allocation causes |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 486 |
| 491 void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkWidget* widget) { | 487 void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkWidget* widget) { |
| 492 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset"), | 488 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset"), |
| 493 profile()->GetPrefs()); | 489 profile()->GetPrefs()); |
| 494 profile()->ClearTheme(); | 490 profile()->ClearTheme(); |
| 495 } | 491 } |
| 496 | 492 |
| 497 void ContentPageGtk::OnGetThemesButtonClicked(GtkWidget* widget) { | 493 void ContentPageGtk::OnGetThemesButtonClicked(GtkWidget* widget) { |
| 498 UserMetricsRecordAction(UserMetricsAction("Options_ThemesGallery"), | 494 UserMetricsRecordAction(UserMetricsAction("Options_ThemesGallery"), |
| 499 profile()->GetPrefs()); | 495 profile()->GetPrefs()); |
| 500 #if defined(OS_CHROMEOS) | |
| 501 // Close options dialog for ChromeOS becuase it is always stacked on top | |
| 502 // of browser window and blocks user's view. | |
| 503 chromeos::CloseOptionsWindow(); | |
| 504 #endif // defined(OS_CHROMEOS) | |
| 505 | |
| 506 BrowserList::GetLastActive()->OpenThemeGalleryTabAndActivate(); | 496 BrowserList::GetLastActive()->OpenThemeGalleryTabAndActivate(); |
| 507 } | 497 } |
| 508 | 498 |
| 509 void ContentPageGtk::OnSystemTitleBarRadioToggled(GtkWidget* widget) { | 499 void ContentPageGtk::OnSystemTitleBarRadioToggled(GtkWidget* widget) { |
| 510 DCHECK(browser_defaults::kCanToggleSystemTitleBar); | 500 DCHECK(browser_defaults::kCanToggleSystemTitleBar); |
| 511 if (initializing_) | 501 if (initializing_) |
| 512 return; | 502 return; |
| 513 | 503 |
| 514 // We get two signals when selecting a radio button, one for the old radio | 504 // We get two signals when selecting a radio button, one for the old radio |
| 515 // being toggled off and one for the new one being toggled on. Ignore the | 505 // being toggled off and one for the new one being toggled on. Ignore the |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 if (response == GTK_RESPONSE_ACCEPT) { | 599 if (response == GTK_RESPONSE_ACCEPT) { |
| 610 sync_service_->DisableForUser(); | 600 sync_service_->DisableForUser(); |
| 611 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 601 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
| 612 } | 602 } |
| 613 gtk_widget_destroy(widget); | 603 gtk_widget_destroy(widget); |
| 614 } | 604 } |
| 615 | 605 |
| 616 void ContentPageGtk::OnPrivacyDashboardLinkClicked(GtkWidget* widget) { | 606 void ContentPageGtk::OnPrivacyDashboardLinkClicked(GtkWidget* widget) { |
| 617 BrowserList::GetLastActive()->OpenPrivacyDashboardTabAndActivate(); | 607 BrowserList::GetLastActive()->OpenPrivacyDashboardTabAndActivate(); |
| 618 } | 608 } |
| OLD | NEW |