summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/location_bar_view_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 21:23:35 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 21:23:35 +0000
commit67f7191aa0be7791da0c4d9f913b2a90c4eb4dae (patch)
treedaaaf89c0c8f3e8473674282acde2f6e05c14f89 /chrome/browser/gtk/location_bar_view_gtk.cc
parent76ac017bca97c5e45569c43c4aded1e287e2cb0b (diff)
downloadchromium_src-67f7191aa0be7791da0c4d9f913b2a90c4eb4dae.zip
chromium_src-67f7191aa0be7791da0c4d9f913b2a90c4eb4dae.tar.gz
chromium_src-67f7191aa0be7791da0c4d9f913b2a90c4eb4dae.tar.bz2
Port PageActionPopupTest to Linux by filling in missing functionality in locationbarviewgtk.
BUG=30326 TEST=test passes Review URL: http://codereview.chromium.org/507032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34876 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.cc43
1 files changed, 37 insertions, 6 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 5596267..c3468b8 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -469,17 +469,34 @@ int LocationBarViewGtk::PageActionVisibleCount() {
}
ExtensionAction* LocationBarViewGtk::GetPageAction(size_t index) {
- NOTIMPLEMENTED();
- return NULL;
+ if (index >= page_action_views_.size()) {
+ NOTREACHED();
+ return NULL;
+ }
+
+ return page_action_views_[index]->page_action();
}
ExtensionAction* LocationBarViewGtk::GetVisiblePageAction(size_t index) {
- NOTIMPLEMENTED();
+ size_t visible_index = 0;
+ for (size_t i = 0; i < page_action_views_.size(); ++i) {
+ if (page_action_views_[i]->IsVisible()) {
+ if (index == visible_index++)
+ return page_action_views_[i]->page_action();
+ }
+ }
+
+ NOTREACHED();
return NULL;
}
void LocationBarViewGtk::TestPageActionPressed(size_t index) {
- NOTIMPLEMENTED();
+ if (index >= page_action_views_.size()) {
+ NOTREACHED();
+ return;
+ }
+
+ page_action_views_[index]->TestActivatePageAction();
}
void LocationBarViewGtk::Observe(NotificationType type,
@@ -796,10 +813,18 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility(
visible = false;
}
- if (visible) {
+
+ bool old_visible = IsVisible();
+ if (visible)
gtk_widget_show_all(event_box_.get());
- } else {
+ else
gtk_widget_hide_all(event_box_.get());
+
+ if (visible != old_visible) {
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
+ Source<ExtensionAction>(page_action_),
+ Details<TabContents>(contents));
}
}
@@ -829,6 +854,12 @@ void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(SkBitmap* image,
owner_->UpdatePageActions();
}
+void LocationBarViewGtk::PageActionViewGtk::TestActivatePageAction() {
+ GdkEventButton event;
+ event.button = 1;
+ OnButtonPressed(widget(), &event, this);
+}
+
// static
gboolean LocationBarViewGtk::PageActionViewGtk::OnButtonPressed(
GtkWidget* sender,