| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SCRIPT_BUBBLE_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SCRIPT_BUBBLE_ICON_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SCRIPT_BUBBLE_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SCRIPT_BUBBLE_ICON_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 9 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" | |
| 10 #include "ui/views/controls/image_view.h" | 9 #include "ui/views/controls/image_view.h" |
| 11 | 10 |
| 12 class CommandUpdater; | |
| 13 | |
| 14 // The ScriptBubbleIconView is the code behind the script bubble icon | 11 // The ScriptBubbleIconView is the code behind the script bubble icon |
| 15 // that we show in the Omnibox badged with a number to represent how many | 12 // that we show in the Omnibox badged with a number to represent how many |
| 16 // extensions are running content_scripts in the current page. | 13 // extensions are running content_scripts in the current page. |
| 17 class ScriptBubbleIconView : public views::ImageView, | 14 class ScriptBubbleIconView : public views::ImageView { |
| 18 public TouchableLocationBarView { | |
| 19 public: | 15 public: |
| 20 explicit ScriptBubbleIconView( | 16 explicit ScriptBubbleIconView( |
| 21 LocationBarView::Delegate* location_bar_delegate); | 17 LocationBarView::Delegate* location_bar_delegate); |
| 22 virtual ~ScriptBubbleIconView(); | 18 virtual ~ScriptBubbleIconView(); |
| 23 | 19 |
| 24 // TouchableLocationBarView methods. | |
| 25 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | |
| 26 | |
| 27 // Updates the number shown on the script bubble icon. | 20 // Updates the number shown on the script bubble icon. |
| 28 void SetScriptCount(size_t script_count); | 21 void SetScriptCount(size_t script_count); |
| 29 | 22 |
| 30 private: | 23 private: |
| 31 // views::View methods. | 24 // views::View: |
| 32 virtual void Layout() OVERRIDE; | 25 virtual void Layout() OVERRIDE; |
| 33 | 26 |
| 34 // views::ImageView methods. | 27 // views::ImageView: |
| 35 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 28 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 36 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 29 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 37 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 30 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 38 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 31 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 39 | 32 |
| 40 // ui::EventHandler overrides: | 33 // ui::EventHandler: |
| 41 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 34 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 42 | 35 |
| 43 // Shows the script bubble, anchored to anchor_view. | 36 // Shows the script bubble, anchored to anchor_view. |
| 44 void ShowScriptBubble(views::View* anchor_view, | 37 void ShowScriptBubble(views::View* anchor_view, |
| 45 content::WebContents* web_contents); | 38 content::WebContents* web_contents); |
| 46 | 39 |
| 47 // The location bar that owns us. | 40 // The location bar that owns us. |
| 48 LocationBarView::Delegate* location_bar_delegate_; | 41 LocationBarView::Delegate* location_bar_delegate_; |
| 49 | 42 |
| 50 // The last reported script count. | 43 // The last reported script count. |
| 51 size_t script_count_; | 44 size_t script_count_; |
| 52 | 45 |
| 53 DISALLOW_IMPLICIT_CONSTRUCTORS(ScriptBubbleIconView); | 46 DISALLOW_COPY_AND_ASSIGN(ScriptBubbleIconView); |
| 54 }; | 47 }; |
| 55 | 48 |
| 56 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SCRIPT_BUBBLE_ICON_VIEW_H_ | 49 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SCRIPT_BUBBLE_ICON_VIEW_H_ |
| OLD | NEW |