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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 auto activation_client = aura::client::GetActivationClient( | 46 auto activation_client = aura::client::GetActivationClient( |
47 widget->GetNativeWindow()->GetRootWindow()); | 47 widget->GetNativeWindow()->GetRootWindow()); |
48 // If the popup was being inspected with devtools and the browser window | 48 // If the popup was being inspected with devtools and the browser window |
49 // was closed, then the root window and activation client are already | 49 // was closed, then the root window and activation client are already |
50 // destroyed. | 50 // destroyed. |
51 if (activation_client) | 51 if (activation_client) |
52 activation_client->RemoveObserver(this); | 52 activation_client->RemoveObserver(this); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 void ExtensionPopupAura::OnWindowActivated(aura::Window* gained_active, | 56 void ExtensionPopupAura::OnWindowActivated( |
57 aura::Window* lost_active) { | 57 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 58 aura::Window* gained_active, |
| 59 aura::Window* lost_active) { |
58 // Close on anchor window activation (ie. user clicked the browser window). | 60 // Close on anchor window activation (ie. user clicked the browser window). |
59 // DesktopNativeWidgetAura does not trigger the expected browser widget | 61 // DesktopNativeWidgetAura does not trigger the expected browser widget |
60 // [de]activation events when activating widgets in its own root window. | 62 // [de]activation events when activating widgets in its own root window. |
61 // This additional check handles those cases. See: http://crbug.com/320889 | 63 // This additional check handles those cases. See: http://crbug.com/320889 |
62 if (gained_active == anchor_widget()->GetNativeWindow()) | 64 if (gained_active == anchor_widget()->GetNativeWindow()) |
63 OnAnchorWindowActivation(); | 65 OnAnchorWindowActivation(); |
64 } | 66 } |
OLD | NEW |