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

Unified Diff: chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm

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/cocoa/location_bar/page_action_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
index 778ce2e133de9981c0c348684018a0b66a264ffa..94622b9983fe8732372aa1333a0a56860e513219 100644
--- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm
@@ -18,6 +18,7 @@
#include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/webui/extensions/extension_info_ui.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_resource.h"
@@ -106,20 +107,9 @@ bool PageActionDecoration::OnMousePressed(NSRect frame) {
case LocationBarController::ACTION_NONE:
break;
- case LocationBarController::ACTION_SHOW_POPUP: {
- // Anchor popup at the bottom center of the page action icon.
- AutocompleteTextField* field = owner_->GetAutocompleteTextField();
- NSPoint anchor = GetBubblePointInFrame(frame);
- anchor = [field convertPoint:anchor toView:nil];
-
- const GURL popup_url(page_action_->GetPopupUrl(current_tab_id_));
- [ExtensionPopupController showURL:popup_url
- inBrowser:browser::GetLastActiveBrowser()
- anchoredAt:anchor
- arrowLocation:info_bubble::kTopRight
- devMode:NO];
+ case LocationBarController::ACTION_SHOW_POPUP:
+ ShowPopup(frame, 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
@@ -128,6 +118,10 @@ bool PageActionDecoration::OnMousePressed(NSRect frame) {
// mouse button through to the LocationBarController.
NOTREACHED();
break;
+
+ case LocationBarController::ACTION_SHOW_SCRIPT_POPUP:
+ ShowPopup(frame, ExtensionInfoUI::GetURL(page_action_->extension_id()));
+ break;
}
return true;
@@ -263,6 +257,20 @@ NSMenu* PageActionDecoration::GetMenu() {
return menu_.get();
}
+void PageActionDecoration::ShowPopup(const NSRect& frame,
+ const GURL& popup_url) {
+ // Anchor popup at the bottom center of the page action icon.
+ AutocompleteTextField* field = owner_->GetAutocompleteTextField();
+ NSPoint anchor = GetBubblePointInFrame(frame);
+ anchor = [field convertPoint:anchor toView:nil];
+
+ [ExtensionPopupController showURL:popup_url
+ inBrowser:browser::GetLastActiveBrowser()
+ anchoredAt:anchor
+ arrowLocation:info_bubble::kTopRight
+ devMode:NO];
+}
+
void PageActionDecoration::Observe(
int type,
const content::NotificationSource& source,

Powered by Google App Engine
This is Rietveld 408576698