| 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 "chrome/browser/ui/browser_dialogs.h" |
| 7 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 8 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
| 9 #include "ui/wm/core/window_animations.h" | 10 #include "ui/wm/core/window_animations.h" |
| 10 #include "ui/wm/core/window_util.h" | 11 #include "ui/wm/core/window_util.h" |
| 11 #include "ui/wm/public/activation_client.h" | 12 #include "ui/wm/public/activation_client.h" |
| 12 | 13 |
| 13 // static | 14 // static |
| 14 ExtensionPopup* ExtensionPopup::Create(extensions::ExtensionViewHost* host, | 15 ExtensionPopup* ExtensionPopup::Create(extensions::ExtensionViewHost* host, |
| 15 views::View* anchor_view, | 16 views::View* anchor_view, |
| 16 views::BubbleBorder::Arrow arrow, | 17 views::BubbleBorder::Arrow arrow, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 ->AddObserver(popup); | 28 ->AddObserver(popup); |
| 28 | 29 |
| 29 return popup; | 30 return popup; |
| 30 } | 31 } |
| 31 | 32 |
| 32 ExtensionPopupAura::ExtensionPopupAura(extensions::ExtensionViewHost* host, | 33 ExtensionPopupAura::ExtensionPopupAura(extensions::ExtensionViewHost* host, |
| 33 views::View* anchor_view, | 34 views::View* anchor_view, |
| 34 views::BubbleBorder::Arrow arrow, | 35 views::BubbleBorder::Arrow arrow, |
| 35 ShowAction show_action) | 36 ShowAction show_action) |
| 36 : ExtensionPopup(host, anchor_view, arrow, show_action) { | 37 : ExtensionPopup(host, anchor_view, arrow, show_action) { |
| 38 chrome::RecordDialogCreation(chrome::DialogIdentifier::EXTENSION_POPUP_AURA); |
| 37 } | 39 } |
| 38 | 40 |
| 39 ExtensionPopupAura::~ExtensionPopupAura() { | 41 ExtensionPopupAura::~ExtensionPopupAura() { |
| 40 } | 42 } |
| 41 | 43 |
| 42 void ExtensionPopupAura::OnWidgetDestroying(views::Widget* widget) { | 44 void ExtensionPopupAura::OnWidgetDestroying(views::Widget* widget) { |
| 43 ExtensionPopup::OnWidgetDestroying(widget); | 45 ExtensionPopup::OnWidgetDestroying(widget); |
| 44 | 46 |
| 45 if (widget == GetWidget()) { | 47 if (widget == GetWidget()) { |
| 46 auto* activation_client = aura::client::GetActivationClient( | 48 auto* activation_client = aura::client::GetActivationClient( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 aura::client::ActivationChangeObserver::ActivationReason reason, | 59 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 58 aura::Window* gained_active, | 60 aura::Window* gained_active, |
| 59 aura::Window* lost_active) { | 61 aura::Window* lost_active) { |
| 60 // Close on anchor window activation (ie. user clicked the browser window). | 62 // Close on anchor window activation (ie. user clicked the browser window). |
| 61 // DesktopNativeWidgetAura does not trigger the expected browser widget | 63 // DesktopNativeWidgetAura does not trigger the expected browser widget |
| 62 // [de]activation events when activating widgets in its own root window. | 64 // [de]activation events when activating widgets in its own root window. |
| 63 // This additional check handles those cases. See: http://crbug.com/320889 | 65 // This additional check handles those cases. See: http://crbug.com/320889 |
| 64 if (gained_active == anchor_widget()->GetNativeWindow()) | 66 if (gained_active == anchor_widget()->GetNativeWindow()) |
| 65 OnAnchorWindowActivation(); | 67 OnAnchorWindowActivation(); |
| 66 } | 68 } |
| OLD | NEW |