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 "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" | |
11 #include "ui/views/controls/image_view.h" | 10 #include "ui/views/controls/image_view.h" |
12 | 11 |
13 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
14 // | 13 // |
15 // LocationBarDecorationView | 14 // LocationBarDecorationView |
16 // | 15 // |
17 // 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 |
18 // in the omnibox (like the bookmarks star or SSL lock). | 17 // in the omnibox (like the bookmarks star or SSL lock). |
19 // | 18 // |
20 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
21 class LocationBarDecorationView : public views::ImageView, | 20 class LocationBarDecorationView : public views::ImageView { |
22 public TouchableLocationBarView { | |
23 public: | 21 public: |
24 LocationBarDecorationView(); | 22 LocationBarDecorationView(); |
25 virtual ~LocationBarDecorationView(); | 23 virtual ~LocationBarDecorationView(); |
26 | 24 |
27 // views::ImageView: | 25 // views::ImageView: |
28 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 26 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
29 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 27 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
30 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 28 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
31 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 29 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
32 | 30 |
33 // TouchableLocationBarView: | |
34 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | |
35 | |
36 protected: | 31 protected: |
37 // 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 |
38 // 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 |
39 // |OnClick()| to be called. | 34 // |OnClick()| to be called. |
40 virtual bool CanHandleClick() const; | 35 virtual bool CanHandleClick() const; |
41 | 36 |
42 // 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. |
43 virtual void OnClick() = 0; | 38 virtual void OnClick() = 0; |
44 | 39 |
45 private: | 40 private: |
46 // 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()| |
47 // was true at that point. | 42 // was true at that point. |
48 bool could_handle_click_; | 43 bool could_handle_click_; |
49 | 44 |
50 DISALLOW_COPY_AND_ASSIGN(LocationBarDecorationView); | 45 DISALLOW_COPY_AND_ASSIGN(LocationBarDecorationView); |
51 }; | 46 }; |
52 | 47 |
53 #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 |