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 15 matching lines...) Expand all Loading... | |
63 | 59 |
64 } // anonymous namespace | 60 } // anonymous namespace |
65 | 61 |
66 /////////////////////////////////////////////////////////////////////////////// | 62 /////////////////////////////////////////////////////////////////////////////// |
67 // ContentPageGtk, public: | 63 // ContentPageGtk, public: |
68 | 64 |
69 ContentPageGtk::ContentPageGtk(Profile* profile) | 65 ContentPageGtk::ContentPageGtk(Profile* profile) |
70 : OptionsPageBase(profile), | 66 : OptionsPageBase(profile), |
71 sync_status_label_background_(NULL), | 67 sync_status_label_background_(NULL), |
72 sync_status_label_(NULL), | 68 sync_status_label_(NULL), |
73 #if !defined(OS_CHROMEOS) | 69 #if !defined(OS_CHROMEOS) |
satorux1
2011/02/02 03:29:49
I think you can remove the line, and the correspon
falken
2011/02/02 04:59:34
Done.
| |
74 sync_action_link_background_(NULL), | 70 sync_action_link_background_(NULL), |
75 sync_action_link_(NULL), | 71 sync_action_link_(NULL), |
76 #endif | 72 #endif |
77 sync_start_stop_button_(NULL), | 73 sync_start_stop_button_(NULL), |
78 sync_customize_button_(NULL), | 74 sync_customize_button_(NULL), |
79 privacy_dashboard_link_(NULL), | 75 privacy_dashboard_link_(NULL), |
80 initializing_(true), | 76 initializing_(true), |
81 sync_service_(NULL), | 77 sync_service_(NULL), |
82 managed_prefs_banner_(profile->GetPrefs(), OPTIONS_PAGE_CONTENT) { | 78 managed_prefs_banner_(profile->GetPrefs(), OPTIONS_PAGE_CONTENT) { |
83 if (profile->GetProfileSyncService()) { | 79 if (profile->GetProfileSyncService()) { |
(...skipping 406 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 |