Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: chrome/browser/ui/gtk/reload_button_gtk.h

Issue 6099014: Move chrome/browser/gtk to chrome/browser/ui/gtk (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Move browser/gtk/ to browser/ui/gtk/, leave header stubs, update new header guards Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/process_singleton_dialog.cc ('k') | chrome/browser/ui/gtk/reload_button_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/reload_button_gtk.h
diff --git a/chrome/browser/ui/gtk/reload_button_gtk.h b/chrome/browser/ui/gtk/reload_button_gtk.h
new file mode 100644
index 0000000000000000000000000000000000000000..7689aed03778153087ae2fcde399669576a54eff
--- /dev/null
+++ b/chrome/browser/ui/gtk/reload_button_gtk.h
@@ -0,0 +1,103 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_
+#define CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "base/basictypes.h"
+#include "base/timer.h"
+#include "chrome/browser/gtk/custom_button.h"
+#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
+
+class Browser;
+class GtkThemeProvider;
+class LocationBarViewGtk;
+class Task;
+
+class ReloadButtonGtk : public NotificationObserver {
+ public:
+ enum Mode { MODE_RELOAD = 0, MODE_STOP };
+
+ ReloadButtonGtk(LocationBarViewGtk* location_bar, Browser* browser);
+ ~ReloadButtonGtk();
+
+ GtkWidget* widget() const { return widget_.get(); }
+
+ // Ask for a specified button state. If |force| is true this will be applied
+ // immediately.
+ void ChangeMode(Mode mode, bool force);
+
+ // Provide NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& /* details */);
+
+ private:
+ friend class ReloadButtonGtkTest;
+
+ CHROMEGTK_CALLBACK_0(ReloadButtonGtk, void, OnClicked);
+ CHROMEGTK_CALLBACK_1(ReloadButtonGtk, gboolean, OnExpose, GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(ReloadButtonGtk,
+ gboolean,
+ OnLeaveNotify,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_4(ReloadButtonGtk,
+ gboolean,
+ OnQueryTooltip,
+ gint,
+ gint,
+ gboolean,
+ GtkTooltip*);
+
+ void UpdateThemeButtons();
+
+ void OnDoubleClickTimer();
+ void OnStopToReloadTimer();
+
+ base::OneShotTimer<ReloadButtonGtk> double_click_timer_;
+ base::OneShotTimer<ReloadButtonGtk> stop_to_reload_timer_;
+
+ // These may be NULL when testing.
+ LocationBarViewGtk* const location_bar_;
+ Browser* const browser_;
+
+ // The mode we should be in assuming no timers are running.
+ Mode intended_mode_;
+
+ // The currently-visible mode - this may differ from the intended mode.
+ Mode visible_mode_;
+
+ // Used to listen for theme change notifications.
+ NotificationRegistrar registrar_;
+
+ GtkThemeProvider* theme_provider_;
+
+ CustomDrawButtonBase reload_;
+ CustomDrawButtonBase stop_;
+ CustomDrawHoverController hover_controller_;
+
+ OwnedWidgetGtk widget_;
+
+ // The delay times for the timers. These are members so that tests can modify
+ // them.
+ base::TimeDelta double_click_timer_delay_;
+ base::TimeDelta stop_to_reload_timer_delay_;
+
+ // TESTING ONLY
+ // True if we should pretend the button is hovered.
+ bool testing_mouse_hovered_;
+ // Increments when we would tell the browser to "reload", so
+ // test code can tell whether we did so (as there may be no |browser_|).
+ int testing_reload_count_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ReloadButtonGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_RELOAD_BUTTON_GTK_H_
« no previous file with comments | « chrome/browser/ui/gtk/process_singleton_dialog.cc ('k') | chrome/browser/ui/gtk/reload_button_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698