| 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 #ifndef CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 12 #include "base/timer.h" | 13 #include "base/timer.h" |
| 13 #include "chrome/browser/ui/gtk/custom_button.h" | 14 #include "chrome/browser/ui/gtk/custom_button.h" |
| 14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 16 #include "ui/base/gtk/gtk_signal.h" | 17 #include "ui/base/gtk/gtk_signal.h" |
| 17 #include "ui/base/gtk/owned_widget_gtk.h" | 18 #include "ui/base/gtk/owned_widget_gtk.h" |
| 18 | 19 |
| 19 class Browser; | 20 class Browser; |
| 20 class GtkThemeService; | 21 class GtkThemeService; |
| 21 class LocationBarViewGtk; | 22 class LocationBarViewGtk; |
| 22 | 23 |
| 23 class ReloadButtonGtk : public content::NotificationObserver { | 24 class ReloadButtonGtk : public content::NotificationObserver { |
| 24 public: | 25 public: |
| 25 enum Mode { MODE_RELOAD = 0, MODE_STOP }; | 26 enum Mode { MODE_RELOAD = 0, MODE_STOP }; |
| 26 | 27 |
| 27 ReloadButtonGtk(LocationBarViewGtk* location_bar, Browser* browser); | 28 ReloadButtonGtk(LocationBarViewGtk* location_bar, Browser* browser); |
| 28 virtual ~ReloadButtonGtk(); | 29 virtual ~ReloadButtonGtk(); |
| 29 | 30 |
| 30 GtkWidget* widget() const { return widget_.get(); } | 31 GtkWidget* widget() const { return widget_.get(); } |
| 31 | 32 |
| 32 // Ask for a specified button state. If |force| is true this will be applied | 33 // Ask for a specified button state. If |force| is true this will be applied |
| 33 // immediately. | 34 // immediately. |
| 34 void ChangeMode(Mode mode, bool force); | 35 void ChangeMode(Mode mode, bool force); |
| 35 | 36 |
| 36 // Provide content::NotificationObserver implementation. | 37 // Provide content::NotificationObserver implementation. |
| 37 virtual void Observe(int type, | 38 virtual void Observe(int type, |
| 38 const content::NotificationSource& source, | 39 const content::NotificationSource& source, |
| 39 const content::NotificationDetails& details); | 40 const content::NotificationDetails& details) OVERRIDE; |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 friend class ReloadButtonGtkTest; | 43 friend class ReloadButtonGtkTest; |
| 43 | 44 |
| 44 CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked); | 45 CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked); |
| 45 CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnExpose, GdkEventExpose*); | 46 CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnExpose, GdkEventExpose*); |
| 46 CHROMEGTK_CALLBACK_1(ReloadButtonGtk, | 47 CHROMEGTK_CALLBACK_1(ReloadButtonGtk, |
| 47 gboolean, | 48 gboolean, |
| 48 OnLeaveNotify, | 49 OnLeaveNotify, |
| 49 GdkEventCrossing*); | 50 GdkEventCrossing*); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // True if we should pretend the button is hovered. | 94 // True if we should pretend the button is hovered. |
| 94 bool testing_mouse_hovered_; | 95 bool testing_mouse_hovered_; |
| 95 // Increments when we would tell the browser to "reload", so | 96 // Increments when we would tell the browser to "reload", so |
| 96 // test code can tell whether we did so (as there may be no |browser_|). | 97 // test code can tell whether we did so (as there may be no |browser_|). |
| 97 int testing_reload_count_; | 98 int testing_reload_count_; |
| 98 | 99 |
| 99 DISALLOW_IMPLICIT_CONSTRUCTORS(ReloadButtonGtk); | 100 DISALLOW_IMPLICIT_CONSTRUCTORS(ReloadButtonGtk); |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 #endif // CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_ | 103 #endif // CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_ |
| OLD | NEW |