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

Unified Diff: chrome/browser/ui/views/extensions/extension_action_view_controller.cc

Issue 547303003: Keep reference view pressed while extension actions have a popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VIEWS_EXPORT fix Created 6 years, 3 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/extensions/extension_action_view_controller.cc
diff --git a/chrome/browser/ui/views/extensions/extension_action_view_controller.cc b/chrome/browser/ui/views/extensions/extension_action_view_controller.cc
index e03d2968fcd5076781be3515969879ef41814500..e17e5ce7742991411fdbf8a912712b341357013d 100644
--- a/chrome/browser/ui/views/extensions/extension_action_view_controller.cc
+++ b/chrome/browser/ui/views/extensions/extension_action_view_controller.cc
@@ -72,11 +72,8 @@ bool ExtensionActionViewController::ExecuteAction(
ExecuteExtensionAction(extension_, browser_, grant_tab_permissions) ==
ExtensionAction::ACTION_SHOW_POPUP) {
GURL popup_url = extension_action_->GetPopupUrl(GetCurrentTabId());
- if (delegate_->GetPreferredPopupViewController()->ShowPopupWithUrl(
- show_action, popup_url)) {
- delegate_->OnPopupShown(grant_tab_permissions);
- return true;
- }
+ return delegate_->GetPreferredPopupViewController()->ShowPopupWithUrl(
+ show_action, popup_url, grant_tab_permissions);
}
return false;
}
@@ -203,8 +200,6 @@ void ExtensionActionViewController::DoShowContextMenu(
// We shouldn't have both a popup and a context menu showing.
delegate_->HideActivePopup();
- delegate_->OnWillShowContextMenus();
-
// Reconstructs the menu every time because the menu's contents are dynamic.
scoped_refptr<ExtensionContextMenuModel> context_menu_model(
new ExtensionContextMenuModel(extension_, browser_, this));
@@ -224,7 +219,7 @@ void ExtensionActionViewController::DoShowContextMenu(
if (menu_runner_->RunMenuAt(
parent,
- NULL,
+ delegate_->GetContextMenuButton(),
gfx::Rect(screen_loc, delegate_->GetAsView()->size()),
views::MENU_ANCHOR_TOPLEFT,
source_type) == views::MenuRunner::MENU_DELETED) {
@@ -233,7 +228,6 @@ void ExtensionActionViewController::DoShowContextMenu(
context_menu_owner = NULL;
menu_runner_.reset();
- delegate_->OnContextMenuDone();
// If another extension action wants to show its context menu, allow it to.
if (!followup_context_menu_task_.is_null()) {
@@ -244,7 +238,9 @@ void ExtensionActionViewController::DoShowContextMenu(
}
bool ExtensionActionViewController::ShowPopupWithUrl(
- ExtensionPopup::ShowAction show_action, const GURL& popup_url) {
+ ExtensionPopup::ShowAction show_action,
+ const GURL& popup_url,
+ bool grant_tab_permissions) {
// If we're already showing the popup for this browser action, just hide it
// and return.
bool already_showing = popup_ != NULL;
@@ -269,6 +265,8 @@ bool ExtensionActionViewController::ShowPopupWithUrl(
popup_url, browser_, reference_view, arrow, show_action);
popup_->GetWidget()->AddObserver(this);
+ delegate_->OnPopupShown(grant_tab_permissions);
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698