summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/gtk/script_bubble_gtk.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 08:40:02 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 08:40:02 +0000
commita6227ad9a660be0a7704fb8115e3a6db7619759d (patch)
tree3abcfe88f721d4b25881d50ad89a7f72df3be2a2 /chrome/browser/ui/gtk/script_bubble_gtk.h
parent74dca3bac433c591a4fe5c95f032f2bf3d7d3c5a (diff)
downloadchromium_src-a6227ad9a660be0a7704fb8115e3a6db7619759d.zip
chromium_src-a6227ad9a660be0a7704fb8115e3a6db7619759d.tar.gz
chromium_src-a6227ad9a660be0a7704fb8115e3a6db7619759d.tar.bz2
Implement script bubble for GTK.
Note: The link in the bubble takes you to the chrome://extensions page but does not highlight the extension you clicked on. BUG=153137 TBR=ben TEST=Install an extension with a content script, such as Google Dictionary or Turn of the lights. You should see a puzzle piece in the Omnibox indicating how many content scripts are running on the page. Click the puzzle piece to see a list of extensions running the content scripts. Review URL: https://chromiumcodereview.appspot.com/11348304 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk/script_bubble_gtk.h')
-rw-r--r--chrome/browser/ui/gtk/script_bubble_gtk.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/chrome/browser/ui/gtk/script_bubble_gtk.h b/chrome/browser/ui/gtk/script_bubble_gtk.h
new file mode 100644
index 0000000..d8a7386
--- /dev/null
+++ b/chrome/browser/ui/gtk/script_bubble_gtk.h
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 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_GTK_SCRIPT_BUBBLE_GTK_H_
+#define CHROME_BROWSER_UI_GTK_SCRIPT_BUBBLE_GTK_H_
+
+#include <map>
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
+#include "chrome/common/content_settings_types.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "ui/base/gtk/gtk_signal.h"
+#include "ui/gfx/image/image.h"
+
+class ContentSettingBubbleModel;
+class Profile;
+
+namespace content {
+class WebContents;
+}
+
+// A bubble that is displayed to show users when extensions are interacting
+// with the current page.
+class ScriptBubbleGtk : public BubbleDelegateGtk {
+ public:
+ static void Show(GtkWidget* anchor, content::WebContents* web_contents);
+
+ private:
+ void Close();
+
+ virtual ~ScriptBubbleGtk();
+
+ ScriptBubbleGtk(GtkWidget* anchor, content::WebContents* web_contents);
+
+ // BubbleDelegateGtk:
+ virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
+
+ // Builds the bubble and all the widgets that it displays.
+ void BuildBubble();
+
+ void OnIconLoaded(const std::string& extension_id, const gfx::Image& icon);
+
+ // Widget callback methods.
+ static void OnItemLinkClickedThunk(GtkWidget* sender, void* user_data);
+ void OnItemLinkClicked(GtkWidget* sender);
+
+ // We position the bubble near this widget.
+ GtkWidget* anchor_;
+
+ // The WebContents we're being displayed for.
+ content::WebContents* web_contents_;
+
+ // The active profile.
+ Profile* profile_;
+
+ // The bubble.
+ BubbleGtk* bubble_;
+
+ std::map<std::string, GtkImage*> icon_controls_;
+ std::map<GtkWidget*, std::string> link_controls_;
+
+ base::WeakPtrFactory<ScriptBubbleGtk> weak_ptr_factory_;
+};
+
+#endif // CHROME_BROWSER_UI_GTK_SCRIPT_BUBBLE_GTK_H_