summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/location_bar_view_gtk.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 21:24:11 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 21:24:11 +0000
commit9e3d8b9ab8f5d4da09f2894866d369aba0f0d005 (patch)
treeb9b3c4dc817c0b1268ac0fbf56154ad39d57e38a /chrome/browser/gtk/location_bar_view_gtk.cc
parent0f6bd72df6b38ef02909934aab3504f92913fb4b (diff)
downloadchromium_src-9e3d8b9ab8f5d4da09f2894866d369aba0f0d005.zip
chromium_src-9e3d8b9ab8f5d4da09f2894866d369aba0f0d005.tar.gz
chromium_src-9e3d8b9ab8f5d4da09f2894866d369aba0f0d005.tar.bz2
gtk: Show page action popup bubbles.
Focus is a bit weird within these; I suspect that it's the same with the browser action bubbles. It looks like the same issue that the bookmark bubble had: the bubble grabs the pointer; when a widget within it (e.g. combobox) gets clicked it steals the grab; when it ungrabs it the grab is released instead of being transferred back to the bubble. Unsure of what the correct fix is for this. BUG=28061 TEST=installed two separate extensions with page action popups and clicked on their icons Review URL: http://codereview.chromium.org/412001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/location_bar_view_gtk.cc')
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 209ae6d..ab5f288 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/extensions/extension_browser_event_router.h"
#include "chrome/browser/extensions/extension_tabs_module.h"
#include "chrome/browser/gtk/cairo_cached_surface.h"
+#include "chrome/browser/gtk/extension_popup_gtk.h"
#include "chrome/browser/gtk/first_run_bubble.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/rounded_window.h"
@@ -742,8 +743,9 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
bool visible = page_action_->GetIsVisible(current_tab_id_);
if (visible) {
// Set the tooltip.
- gtk_widget_set_tooltip_text(event_box_.get(),
- page_action_->GetTitle(current_tab_id_).c_str());
+ gtk_widget_set_tooltip_text(
+ event_box_.get(),
+ page_action_->GetTitle(current_tab_id_).c_str());
// Set the image.
// It can come from three places. In descending order of priority:
@@ -828,13 +830,22 @@ gboolean LocationBarViewGtk::PageActionViewGtk::OnButtonPressed(
GtkWidget* sender,
GdkEventButton* event,
LocationBarViewGtk::PageActionViewGtk* page_action_view) {
- ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted(
- page_action_view->profile_,
- page_action_view->page_action_->extension_id(),
- page_action_view->page_action_->id(),
- page_action_view->current_tab_id_,
- page_action_view->current_url_.spec(),
- event->button);
+ ExtensionAction* page_action = page_action_view->page_action_;
+ if (page_action->has_popup()) {
+ ExtensionPopupGtk::Show(
+ page_action->popup_url(),
+ page_action_view->owner_->browser_,
+ gtk_util::GetWidgetRectRelativeToToplevel(
+ page_action_view->event_box_.get()));
+ } else {
+ ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted(
+ page_action_view->profile_,
+ page_action->extension_id(),
+ page_action->id(),
+ page_action_view->current_tab_id_,
+ page_action_view->current_url_.spec(),
+ event->button);
+ }
return true;
}