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
3 // found in the LICENSE file.
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_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/controls/image_view.h"
12 ////////////////////////////////////////////////////////////////////////////////
14 // LocationBarDecorationView
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).
19 ////////////////////////////////////////////////////////////////////////////////
20 class LocationBarDecorationView : public views::ImageView {
22 LocationBarDecorationView();
23 virtual ~LocationBarDecorationView();
26 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
27 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
28 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
29 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
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
34 // |OnClick()| to be called.
35 virtual bool CanHandleClick() const;
37 // Called when a user mouses up, taps, or presses a key on this icon.
38 virtual void OnClick() = 0;
41 // Set when the user's mouse goes down to determine whether |CanHandleClick()|
42 // was true at that point.
43 bool could_handle_click_;
45 DISALLOW_COPY_AND_ASSIGN(LocationBarDecorationView);
48 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_DECORATION_VIEW_H_