| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
| 11 | 11 |
| 12 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
| 13 // | 13 // |
| 14 // LocationBarDecorationView | 14 // LocationBarDecorationView |
| 15 // | 15 // |
| 16 // An abstract class to provide common functionality to all icons that show up | 16 // An abstract class to provide common functionality to all icons that show up |
| 17 // in the omnibox (like the bookmarks star or SSL lock). | 17 // in the omnibox (like the bookmarks star or SSL lock). |
| 18 // | 18 // |
| 19 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 20 class LocationBarDecorationView : public views::ImageView { | 20 class LocationBarDecorationView : public views::ImageView { |
| 21 public: | 21 public: |
| 22 LocationBarDecorationView(); | 22 LocationBarDecorationView(); |
| 23 virtual ~LocationBarDecorationView(); | 23 virtual ~LocationBarDecorationView(); |
| 24 | 24 |
| 25 // views::ImageView: | 25 // views::ImageView: |
| 26 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 26 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
| 27 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 27 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
| 28 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 28 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 29 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 29 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 // Whether this icon should currently be able to process a mouse click. Called | 32 // Whether this icon should currently be able to process a mouse click. Called |
| 33 // both on mouse up and mouse down; must return true both times to for | 33 // both on mouse up and mouse down; must return true both times to for |
| 34 // |OnClick()| to be called. | 34 // |OnClick()| to be called. |
| 35 virtual bool CanHandleClick() const; | 35 virtual bool CanHandleClick() const; |
| 36 | 36 |
| 37 // Called when a user mouses up, taps, or presses a key on this icon. | 37 // Called when a user mouses up, taps, or presses a key on this icon. |
| 38 virtual void OnClick() = 0; | 38 virtual void OnClick() = 0; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // Set when the user's mouse goes down to determine whether |CanHandleClick()| | 41 // Set when the user's mouse goes down to determine whether |CanHandleClick()| |
| 42 // was true at that point. | 42 // was true at that point. |
| 43 bool could_handle_click_; | 43 bool could_handle_click_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(LocationBarDecorationView); | 45 DISALLOW_COPY_AND_ASSIGN(LocationBarDecorationView); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_ | 48 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_ |
| OLD | NEW |