Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/bubble_icon_view.h |
| diff --git a/chrome/browser/ui/views/location_bar/bubble_icon_view.h b/chrome/browser/ui/views/location_bar/bubble_icon_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ad7ea5adae41279bc8e8d5843b850f8072f11c99 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/location_bar/bubble_icon_view.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2013 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_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |
| + |
| +#include "ui/views/controls/image_view.h" |
| + |
| +class CommandUpdater; |
| + |
| +// Represents an icon on the omnibox that shows a bubble when clicked. |
| +class BubbleIconView : public views::ImageView { |
| + protected: |
| + enum ExecuteSource { |
| + EXECUTE_SOURCE_MOUSE, |
| + EXECUTE_SOURCE_KEYBOARD, |
| + EXECUTE_SOURCE_GESTURE, |
| + }; |
| + |
| + explicit BubbleIconView(CommandUpdater* command_updater, int command_id); |
| + virtual ~BubbleIconView(); |
| + |
| + // Returns true if a related bubble is already shown. |
|
sky
2013/10/24 15:49:08
'already shown' -> showing
hajimehoshi
2013/10/25 02:45:40
Done.
|
| + virtual bool IsBubbleShowing() const = 0; |
| + |
| + // Handles when the command is executed. |
|
sky
2013/10/24 15:49:08
Invoked prior to executing the command.
hajimehoshi
2013/10/25 02:45:40
Done.
|
| + virtual void OnExecuting(ExecuteSource execute_source) = 0; |
| + |
| + // views::ImageView: |
| + virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| + virtual bool GetTooltipText(const gfx::Point& p, string16* tooltip) |
| + const OVERRIDE; |
| + virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| + virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| + virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| + |
| + // ui::EventHandler: |
| + virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| + |
| + private: |
| + // The CommandUpdater for the Browser object that owns the location bar. |
| + CommandUpdater* command_updater_; |
| + |
| + // The command ID executed when the user clicks this icon. |
| + const int command_id_; |
| + |
| + // This is used to check if the bookmark bubble was showing during the mouse |
| + // pressed event. If this is true then the mouse released event is ignored to |
| + // prevent the bubble from reshowing. |
| + bool suppress_mouse_released_action_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BubbleIconView); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_BUBBLE_ICON_VIEW_H_ |