- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / script_bubble_gtk.h
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.
4
5 #ifndef CHROME_BROWSER_UI_GTK_SCRIPT_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_SCRIPT_BUBBLE_GTK_H_
7
8 #include <map>
9
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
14 #include "chrome/common/content_settings_types.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h"
17 #include "ui/base/gtk/gtk_signal.h"
18 #include "ui/gfx/image/image.h"
19
20 class ContentSettingBubbleModel;
21 class Profile;
22
23 namespace content {
24 class WebContents;
25 }
26
27 // A bubble that is displayed to show users when extensions are interacting
28 // with the current page.
29 class ScriptBubbleGtk : public BubbleDelegateGtk {
30  public:
31   static void Show(GtkWidget* anchor, content::WebContents* web_contents);
32
33  private:
34   void Close();
35
36   virtual ~ScriptBubbleGtk();
37
38   ScriptBubbleGtk(GtkWidget* anchor, content::WebContents* web_contents);
39
40   // BubbleDelegateGtk:
41   virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
42
43   // Builds the bubble and all the widgets that it displays.
44   void BuildBubble();
45
46   void OnIconLoaded(const std::string& extension_id, const gfx::Image& icon);
47
48   // Widget callback methods.
49   static void OnItemLinkClickedThunk(GtkWidget* sender, void* user_data);
50   void OnItemLinkClicked(GtkWidget* sender);
51
52   // We position the bubble near this widget.
53   GtkWidget* anchor_;
54
55   // The WebContents we're being displayed for.
56   content::WebContents* web_contents_;
57
58   // The active profile.
59   Profile* profile_;
60
61   // The bubble.
62   BubbleGtk* bubble_;
63
64   std::map<std::string, GtkImage*> icon_controls_;
65   std::map<GtkWidget*, std::string> link_controls_;
66
67   base::WeakPtrFactory<ScriptBubbleGtk> weak_ptr_factory_;
68 };
69
70 #endif  // CHROME_BROWSER_UI_GTK_SCRIPT_BUBBLE_GTK_H_