| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_GO_BUTTON_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_GO_BUTTON_H__ |
| 6 #define CHROME_BROWSER_VIEWS_GO_BUTTON_H__ | 6 #define CHROME_BROWSER_VIEWS_GO_BUTTON_H__ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "chrome/views/controls/button/image_button.h" | 10 #include "chrome/views/controls/button/image_button.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
| 26 | 26 |
| 27 class GoButton : public views::ToggleImageButton, | 27 class GoButton : public views::ToggleImageButton, |
| 28 public views::ButtonListener { | 28 public views::ButtonListener { |
| 29 public: | 29 public: |
| 30 typedef enum Mode { MODE_GO = 0, MODE_STOP }; | 30 typedef enum Mode { MODE_GO = 0, MODE_STOP }; |
| 31 | 31 |
| 32 GoButton(LocationBarView* location_bar, Browser* Browser); | 32 GoButton(LocationBarView* location_bar, Browser* Browser); |
| 33 virtual ~GoButton(); | 33 virtual ~GoButton(); |
| 34 | 34 |
| 35 // Force the button state | 35 // Ask for a specified button state. If |force| is true this will be applied |
| 36 void ChangeMode(Mode mode); | 36 // immediately. |
| 37 | 37 void ChangeMode(Mode mode, bool force); |
| 38 // Ask for a specified button state. This is commonly called by the Browser | |
| 39 // when page load state changes. | |
| 40 void ScheduleChangeMode(Mode mode); | |
| 41 | 38 |
| 42 // Overridden from views::ButtonListener: | 39 // Overridden from views::ButtonListener: |
| 43 virtual void ButtonPressed(views::Button* button); | 40 virtual void ButtonPressed(views::Button* button); |
| 44 | 41 |
| 45 // Overridden from views::View: | 42 // Overridden from views::View: |
| 46 virtual void OnMouseExited(const views::MouseEvent& e); | 43 virtual void OnMouseExited(const views::MouseEvent& e); |
| 47 virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); | 44 virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); |
| 48 | 45 |
| 49 private: | 46 private: |
| 50 void OnButtonTimer(); | 47 void OnButtonTimer(); |
| 51 | 48 |
| 52 int button_delay_; | 49 int button_delay_; |
| 53 ScopedRunnableMethodFactory<GoButton> stop_timer_; | 50 ScopedRunnableMethodFactory<GoButton> stop_timer_; |
| 54 | 51 |
| 55 LocationBarView* location_bar_; | 52 LocationBarView* location_bar_; |
| 56 Browser* browser_; | 53 Browser* browser_; |
| 57 | 54 |
| 58 // The mode we should be in | 55 // The mode we should be in |
| 59 Mode intended_mode_; | 56 Mode intended_mode_; |
| 60 | 57 |
| 61 // The currently-visible mode - this may different from the intended mode | 58 // The currently-visible mode - this may different from the intended mode |
| 62 Mode visible_mode_; | 59 Mode visible_mode_; |
| 63 | 60 |
| 64 DISALLOW_COPY_AND_ASSIGN(GoButton); | 61 DISALLOW_COPY_AND_ASSIGN(GoButton); |
| 65 }; | 62 }; |
| 66 | 63 |
| 67 #endif // CHROME_BROWSER_VIEWS_GO_BUTTON_H__ | 64 #endif // CHROME_BROWSER_VIEWS_GO_BUTTON_H__ |
| OLD | NEW |