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

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

Issue 1105713002: [Extension Toolbar] Slide out overflowed actions for popups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 8 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_platform_delegate_views.cc
diff --git a/chrome/browser/ui/views/extensions/extension_action_platform_delegate_views.cc b/chrome/browser/ui/views/extensions/extension_action_platform_delegate_views.cc
index 503a7f102844ce3dcc6b69c8bf8d0cbaa3e78944..8c8c154181fa3ba7bdae08c7bd4121d9402bdd2f 100644
--- a/chrome/browser/ui/views/extensions/extension_action_platform_delegate_views.cc
+++ b/chrome/browser/ui/views/extensions/extension_action_platform_delegate_views.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "chrome/browser/extensions/extension_action.h"
+#include "chrome/browser/extensions/extension_view_host.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/accelerator_priority.h"
@@ -91,11 +92,10 @@ void ExtensionActionPlatformDelegateViews::OnDelegateSet() {
GetDelegateViews()->GetAsView()->set_context_menu_controller(this);
}
-extensions::ExtensionViewHost*
-ExtensionActionPlatformDelegateViews::ShowPopupWithUrl(
- ExtensionActionViewController::PopupShowAction show_action,
- const GURL& popup_url,
- bool grant_tab_permissions) {
+void ExtensionActionPlatformDelegateViews::ShowPopup(
+ scoped_ptr<extensions::ExtensionViewHost> host,
+ bool grant_tab_permissions,
+ ExtensionActionViewController::PopupShowAction show_action) {
// TOP_RIGHT is correct for both RTL and LTR, because the views platform
// performs the flipping in RTL cases.
views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT;
@@ -105,12 +105,17 @@ ExtensionActionPlatformDelegateViews::ShowPopupWithUrl(
ExtensionPopup::ShowAction popup_show_action =
show_action == ExtensionActionViewController::SHOW_POPUP ?
ExtensionPopup::SHOW : ExtensionPopup::SHOW_AND_INSPECT;
- ExtensionPopup* popup = ExtensionPopup::ShowPopup(popup_url,
- controller_->browser(),
- reference_view,
- arrow,
- popup_show_action);
- return popup->host();
+ ExtensionPopup::ShowPopup(host.Pass(),
+ reference_view,
+ arrow,
+ popup_show_action);
+}
+
+void ExtensionActionPlatformDelegateViews::CloseOverflowMenu() {
+ ToolbarView* toolbar =
+ BrowserView::GetBrowserViewForBrowser(controller_->browser())->toolbar();
+ if (toolbar->IsWrenchMenuShowing())
+ toolbar->CloseAppMenu();
}
void ExtensionActionPlatformDelegateViews::Observe(
@@ -197,9 +202,6 @@ void ExtensionActionPlatformDelegateViews::DoShowContextMenu(
DCHECK(!context_menu_owner);
context_menu_owner = this;
- // We shouldn't have both a popup and a context menu showing.
- controller_->HideActivePopup();
-
gfx::Point screen_loc;
views::View::ConvertPointToScreen(GetDelegateViews()->GetAsView(),
&screen_loc);
@@ -213,6 +215,9 @@ void ExtensionActionPlatformDelegateViews::DoShowContextMenu(
menu_runner_.reset(new views::MenuRunner(context_menu_model, run_types));
+ // We shouldn't have both a popup and a context menu showing.
+ controller_->HideActivePopup();
+
if (menu_runner_->RunMenuAt(
parent,
GetDelegateViews()->GetContextMenuButton(),
@@ -224,6 +229,7 @@ void ExtensionActionPlatformDelegateViews::DoShowContextMenu(
context_menu_owner = NULL;
menu_runner_.reset();
+ controller_->OnMenuClosed();
// If another extension action wants to show its context menu, allow it to.
if (!followup_context_menu_task_.is_null()) {

Powered by Google App Engine
This is Rietveld 408576698