Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1874)

Unified Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 10544195: Show an extension info bubble when a script badge is clicked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename resources Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/page_action_image_view.cc
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
index 46ff5f26701361474f21b4b46259845b57657d01..a9591da9890aad07ee466d7a058f1a1842d29bee 100644
--- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
+#include "chrome/browser/ui/webui/extensions/extension_info_ui.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
@@ -105,27 +106,9 @@ void PageActionImageView::ExecuteAction(int button) {
case LocationBarController::ACTION_NONE:
break;
- case LocationBarController::ACTION_SHOW_POPUP: {
- bool popup_showing = popup_ != NULL;
-
- // Always hide the current popup. Only one popup at a time.
- HidePopup();
-
- // If we were already showing, then treat this click as a dismiss.
- if (popup_showing)
- return;
-
- views::BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ?
- views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT;
-
- popup_ = ExtensionPopup::ShowPopup(
- page_action_->GetPopupUrl(current_tab_id_),
- browser_,
- this,
- arrow_location);
- popup_->GetWidget()->AddObserver(this);
+ case LocationBarController::ACTION_SHOW_POPUP:
+ ShowPopupWithURL(page_action_->GetPopupUrl(current_tab_id_));
break;
- }
case LocationBarController::ACTION_SHOW_CONTEXT_MENU:
// We are never passing OnClicked a right-click button, so assume that
@@ -134,6 +117,10 @@ void PageActionImageView::ExecuteAction(int button) {
// mouse button through to the LocationBarController.
NOTREACHED();
break;
+
+ case LocationBarController::ACTION_SHOW_SCRIPT_POPUP:
+ ShowPopupWithURL(ExtensionInfoUI::GetURL(page_action_->extension_id()));
+ break;
}
}
@@ -296,6 +283,23 @@ void PageActionImageView::Observe(int type,
owner_->UpdatePageActions();
}
+void PageActionImageView::ShowPopupWithURL(const GURL& popup_url) {
+ bool popup_showing = popup_ != NULL;
+
+ // Always hide the current popup. Only one popup at a time.
+ HidePopup();
+
+ // If we were already showing, then treat this click as a dismiss.
+ if (popup_showing)
+ return;
+
+ views::BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ?
+ views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT;
+
+ popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location);
+ popup_->GetWidget()->AddObserver(this);
+}
+
void PageActionImageView::HidePopup() {
if (popup_)
popup_->GetWidget()->Close();

Powered by Google App Engine
This is Rietveld 408576698