| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/extensions/extension_popup_aura.h" | 5 #include "chrome/browser/ui/views/extensions/extension_popup_aura.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
| 9 #include "ui/wm/core/window_animations.h" | 9 #include "ui/wm/core/window_animations.h" |
| 10 #include "ui/wm/core/window_util.h" | 10 #include "ui/wm/core/window_util.h" |
| 11 #include "ui/wm/public/activation_client.h" | 11 #include "ui/wm/public/activation_client.h" |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 ExtensionPopup* ExtensionPopup::Create(extensions::ExtensionViewHost* host, | 14 ExtensionPopup* ExtensionPopup::Create(extensions::ExtensionViewHost* host, |
| 15 views::View* anchor_view, | 15 views::View* anchor_view, |
| 16 views::BubbleBorder::Arrow arrow, | 16 views::BubbleBorder::Arrow arrow, |
| 17 ShowAction show_action) { | 17 ShowAction show_action) { |
| 18 auto popup = new ExtensionPopupAura(host, anchor_view, arrow, show_action); | 18 auto popup = new ExtensionPopupAura(host, anchor_view, arrow, show_action); |
| 19 views::Widget* widget = views::BubbleDelegateView::CreateBubble(popup); | 19 views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(popup); |
| 20 gfx::NativeView native_view = widget->GetNativeView(); | 20 gfx::NativeView native_view = widget->GetNativeView(); |
| 21 | 21 |
| 22 wm::SetWindowVisibilityAnimationType( | 22 wm::SetWindowVisibilityAnimationType( |
| 23 native_view, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 23 native_view, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
| 24 wm::SetWindowVisibilityAnimationVerticalPosition(native_view, -3.0f); | 24 wm::SetWindowVisibilityAnimationVerticalPosition(native_view, -3.0f); |
| 25 | 25 |
| 26 aura::client::GetActivationClient(native_view->GetRootWindow()) | 26 aura::client::GetActivationClient(native_view->GetRootWindow()) |
| 27 ->AddObserver(popup); | 27 ->AddObserver(popup); |
| 28 | 28 |
| 29 return popup; | 29 return popup; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 57 aura::client::ActivationChangeObserver::ActivationReason reason, | 57 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 58 aura::Window* gained_active, | 58 aura::Window* gained_active, |
| 59 aura::Window* lost_active) { | 59 aura::Window* lost_active) { |
| 60 // Close on anchor window activation (ie. user clicked the browser window). | 60 // Close on anchor window activation (ie. user clicked the browser window). |
| 61 // DesktopNativeWidgetAura does not trigger the expected browser widget | 61 // DesktopNativeWidgetAura does not trigger the expected browser widget |
| 62 // [de]activation events when activating widgets in its own root window. | 62 // [de]activation events when activating widgets in its own root window. |
| 63 // This additional check handles those cases. See: http://crbug.com/320889 | 63 // This additional check handles those cases. See: http://crbug.com/320889 |
| 64 if (gained_active == anchor_widget()->GetNativeWindow()) | 64 if (gained_active == anchor_widget()->GetNativeWindow()) |
| 65 OnAnchorWindowActivation(); | 65 OnAnchorWindowActivation(); |
| 66 } | 66 } |
| OLD | NEW |