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

Unified Diff: chrome/browser/cocoa/extensions/extension_action_context_menu.mm

Issue 3176021: Ensure that a browser action is never passed to a function which expects a page action. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Better fix: don't pass a browser action into a function expecting a page action. Created 10 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/cocoa/location_bar/location_bar_view_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/extensions/extension_action_context_menu.mm
diff --git a/chrome/browser/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/cocoa/extensions/extension_action_context_menu.mm
index 797f517dbe0c98f4ca43a1e3e41e2485ba7a231b..be9553d8b3c1005f088a9aad3c5805d94fa8f7da 100644
--- a/chrome/browser/cocoa/extensions/extension_action_context_menu.mm
+++ b/chrome/browser/cocoa/extensions/extension_action_context_menu.mm
@@ -241,13 +241,18 @@ int CurrentTabId() {
[window->cocoa_controller() toolbarController];
LocationBarViewMac* locationBarView =
[toolbarController locationBarBridge];
- NSPoint popupPoint = locationBarView->GetPageActionBubblePoint(action_);
- // If there was no matching page action, it was a browser action.
- if (NSEqualPoints(popupPoint, NSZeroPoint)) {
+ NSPoint popupPoint = NSZeroPoint;
+ if (extension_->page_action() == action_) {
+ popupPoint = locationBarView->GetPageActionBubblePoint(action_);
+
+ } else if (extension_->browser_action() == action_) {
BrowserActionsController* controller =
[toolbarController browserActionsController];
popupPoint = [controller popupPointForBrowserAction:extension_];
+
+ } else {
+ NOTREACHED() << "action_ is not a page action or browser action?";
}
int tabId = CurrentTabId();
« no previous file with comments | « no previous file | chrome/browser/cocoa/location_bar/location_bar_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698