Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / script_bubble_view.h
blob5c14066412aac182aeccc2bf7c347efd81b4a555
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_SCRIPT_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_SCRIPT_BUBBLE_VIEW_H_
8 #include <map>
9 #include <string>
11 #include "base/compiler_specific.h"
12 #include "ui/gfx/image/image.h"
13 #include "ui/views/bubble/bubble_delegate.h"
14 #include "ui/views/controls/link_listener.h"
16 namespace content {
17 class WebContents;
20 namespace extensions {
21 class ScriptBubbleController;
24 namespace views {
25 class ImageView;
28 // The view in the bubble that pops up from the ScriptBubbleIconView that lists
29 // the extensions with the activeTab permission running content scripts on the
30 // current page.
31 class ScriptBubbleView : public views::BubbleDelegateView,
32 public views::LinkListener,
33 public base::SupportsWeakPtr<ScriptBubbleView> {
34 public:
35 ScriptBubbleView(views::View* anchor_view,
36 content::WebContents* web_contents);
37 virtual ~ScriptBubbleView();
39 // views::View methods:
40 virtual gfx::Size GetPreferredSize() OVERRIDE;
42 // LinkListener methods:
43 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
45 private:
46 struct ScriptEntry {
47 ScriptEntry();
49 std::string extension_id;
50 base::string16 extension_name;
51 views::ImageView* extension_imageview;
54 // views::BubbleDelegateView methods:
55 virtual void Init() OVERRIDE;
57 // Call when an image has finished loading.
58 void OnImageLoaded(size_t index, const gfx::Image& image);
60 // A helper function to get the script controller for this tab.
61 extensions::ScriptBubbleController* GetScriptBubbleController();
63 // The height of the bubble in pixels.
64 int height_;
66 // The Web Contents we're dealing with.
67 content::WebContents* web_contents_;
69 // A vector containing information about the scripts running on the page.
70 std::vector<ScriptEntry> entries_;
72 DISALLOW_COPY_AND_ASSIGN(ScriptBubbleView);
75 #endif // CHROME_BROWSER_UI_VIEWS_SCRIPT_BUBBLE_VIEW_H_