| 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/reload_button_gtk.h" | 5 #include "chrome/browser/ui/gtk/reload_button_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 gtk_widget_set_has_tooltip(widget(), TRUE); | 54 gtk_widget_set_has_tooltip(widget(), TRUE); |
| 55 g_signal_connect(widget(), "query-tooltip", G_CALLBACK(OnQueryTooltipThunk), | 55 g_signal_connect(widget(), "query-tooltip", G_CALLBACK(OnQueryTooltipThunk), |
| 56 this); | 56 this); |
| 57 | 57 |
| 58 hover_controller_.Init(widget()); | 58 hover_controller_.Init(widget()); |
| 59 gtk_util::SetButtonTriggersNavigation(widget()); | 59 gtk_util::SetButtonTriggersNavigation(widget()); |
| 60 | 60 |
| 61 if (theme_service_) { | 61 if (theme_service_) { |
| 62 theme_service_->InitThemesFor(this); | 62 theme_service_->InitThemesFor(this); |
| 63 registrar_.Add(this, | 63 registrar_.Add(this, |
| 64 NotificationType::BROWSER_THEME_CHANGED, | 64 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 65 Source<ThemeService>(theme_service_)); | 65 Source<ThemeService>(theme_service_)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Set the default double-click timer delay to the system double-click time. | 68 // Set the default double-click timer delay to the system double-click time. |
| 69 int timer_delay_ms; | 69 int timer_delay_ms; |
| 70 GtkSettings* settings = gtk_settings_get_default(); | 70 GtkSettings* settings = gtk_settings_get_default(); |
| 71 g_object_get(G_OBJECT(settings), "gtk-double-click-time", &timer_delay_ms, | 71 g_object_get(G_OBJECT(settings), "gtk-double-click-time", &timer_delay_ms, |
| 72 NULL); | 72 NULL); |
| 73 double_click_timer_delay_ = base::TimeDelta::FromMilliseconds(timer_delay_ms); | 73 double_click_timer_delay_ = base::TimeDelta::FromMilliseconds(timer_delay_ms); |
| 74 } | 74 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 if (!stop_to_reload_timer_.IsRunning()) { | 120 if (!stop_to_reload_timer_.IsRunning()) { |
| 121 stop_to_reload_timer_.Start(stop_to_reload_timer_delay_, this, | 121 stop_to_reload_timer_.Start(stop_to_reload_timer_delay_, this, |
| 122 &ReloadButtonGtk::OnStopToReloadTimer); | 122 &ReloadButtonGtk::OnStopToReloadTimer); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
| 128 // ReloadButtonGtk, NotificationObserver implementation: | 128 // ReloadButtonGtk, NotificationObserver implementation: |
| 129 | 129 |
| 130 void ReloadButtonGtk::Observe(NotificationType type, | 130 void ReloadButtonGtk::Observe(int type, |
| 131 const NotificationSource& source, | 131 const NotificationSource& source, |
| 132 const NotificationDetails& /* details */) { | 132 const NotificationDetails& /* details */) { |
| 133 DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); | 133 DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); |
| 134 | 134 |
| 135 GtkThemeService* provider = static_cast<GtkThemeService*>( | 135 GtkThemeService* provider = static_cast<GtkThemeService*>( |
| 136 Source<ThemeService>(source).ptr()); | 136 Source<ThemeService>(source).ptr()); |
| 137 DCHECK_EQ(provider, theme_service_); | 137 DCHECK_EQ(provider, theme_service_); |
| 138 GtkButtonWidth = 0; | 138 GtkButtonWidth = 0; |
| 139 UpdateThemeButtons(); | 139 UpdateThemeButtons(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 //////////////////////////////////////////////////////////////////////////////// | 142 //////////////////////////////////////////////////////////////////////////////// |
| 143 // ReloadButtonGtk, private: | 143 // ReloadButtonGtk, private: |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(widget()), use_gtk); | 271 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(widget()), use_gtk); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void ReloadButtonGtk::OnDoubleClickTimer() { | 274 void ReloadButtonGtk::OnDoubleClickTimer() { |
| 275 ChangeMode(intended_mode_, false); | 275 ChangeMode(intended_mode_, false); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void ReloadButtonGtk::OnStopToReloadTimer() { | 278 void ReloadButtonGtk::OnStopToReloadTimer() { |
| 279 ChangeMode(intended_mode_, true); | 279 ChangeMode(intended_mode_, true); |
| 280 } | 280 } |
| OLD | NEW |