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

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

Issue 980663003: MacViews: Refactor aura dependency from ExtensionPopup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aura-window
Patch Set: Fix for msw and rebase Created 5 years, 9 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 | « chrome/browser/ui/views/extensions/extension_popup_aura.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/extensions/extension_popup_aura.cc
diff --git a/chrome/browser/ui/views/extensions/extension_popup_aura.cc b/chrome/browser/ui/views/extensions/extension_popup_aura.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e3e7c909439c83437b801a6a9afe0c9258bbdb41
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/extension_popup_aura.cc
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/extensions/extension_popup_aura.h"
+
+#include "ui/aura/window.h"
+#include "ui/views/widget/widget.h"
+#include "ui/wm/core/window_animations.h"
+#include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
+
+// static
+ExtensionPopup* ExtensionPopup::Create(extensions::ExtensionViewHost* host,
+ views::View* anchor_view,
+ views::BubbleBorder::Arrow arrow,
+ ShowAction show_action) {
+ auto popup = new ExtensionPopupAura(host, anchor_view, arrow, show_action);
+ views::Widget* widget = views::BubbleDelegateView::CreateBubble(popup);
+ gfx::NativeView native_view = widget->GetNativeView();
+
+ wm::SetWindowVisibilityAnimationType(
+ native_view, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL);
+ wm::SetWindowVisibilityAnimationVerticalPosition(native_view, -3.0f);
+
+ aura::client::GetActivationClient(native_view->GetRootWindow())
+ ->AddObserver(popup);
+
+ return popup;
+}
+
+ExtensionPopupAura::ExtensionPopupAura(extensions::ExtensionViewHost* host,
+ views::View* anchor_view,
+ views::BubbleBorder::Arrow arrow,
+ ShowAction show_action)
+ : ExtensionPopup(host, anchor_view, arrow, show_action) {
+}
+
+ExtensionPopupAura::~ExtensionPopupAura() {
+}
+
+void ExtensionPopupAura::OnWidgetDestroying(views::Widget* widget) {
+ ExtensionPopup::OnWidgetDestroying(widget);
+
+ if (widget == GetWidget()) {
+ auto activation_client = aura::client::GetActivationClient(
+ widget->GetNativeWindow()->GetRootWindow());
+ // If the popup was being inspected with devtools and the browser window
+ // was closed, then the root window and activation client are already
+ // destroyed.
+ if (activation_client)
+ activation_client->RemoveObserver(this);
+ }
+}
+
+void ExtensionPopupAura::OnWindowActivated(aura::Window* gained_active,
+ aura::Window* lost_active) {
+ // Close on anchor window activation (ie. user clicked the browser window).
+ // DesktopNativeWidgetAura does not trigger the expected browser widget
+ // [de]activation events when activating widgets in its own root window.
+ // This additional check handles those cases. See: http://crbug.com/320889
+ if (gained_active == anchor_widget()->GetNativeWindow())
+ OnAnchorWindowActivation();
+}
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup_aura.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698