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
3 // found in the LICENSE file.
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_
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "ui/views/controls/image_view.h"
11 // The ScriptBubbleIconView is the code behind the script bubble icon
12 // that we show in the Omnibox badged with a number to represent how many
13 // extensions are running content_scripts in the current page.
14 class ScriptBubbleIconView
: public views::ImageView
{
16 explicit ScriptBubbleIconView(
17 LocationBarView::Delegate
* location_bar_delegate
);
18 virtual ~ScriptBubbleIconView();
20 // Updates the number shown on the script bubble icon.
21 void SetScriptCount(size_t script_count
);
25 virtual void Layout() OVERRIDE
;
28 virtual void GetAccessibleState(ui::AccessibleViewState
* state
) OVERRIDE
;
29 virtual bool OnMousePressed(const ui::MouseEvent
& event
) OVERRIDE
;
30 virtual void OnMouseReleased(const ui::MouseEvent
& event
) OVERRIDE
;
31 virtual bool OnKeyPressed(const ui::KeyEvent
& event
) OVERRIDE
;
34 virtual void OnGestureEvent(ui::GestureEvent
* event
) OVERRIDE
;
36 // Shows the script bubble, anchored to anchor_view.
37 void ShowScriptBubble(views::View
* anchor_view
,
38 content::WebContents
* web_contents
);
40 // The location bar that owns us.
41 LocationBarView::Delegate
* location_bar_delegate_
;
43 // The last reported script count.
46 DISALLOW_COPY_AND_ASSIGN(ScriptBubbleIconView
);
49 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SCRIPT_BUBBLE_ICON_VIEW_H_