| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "ui/views/views_delegate.h" | 41 #include "ui/views/views_delegate.h" |
| 42 #include "ui/views/widget/drop_helper.h" | 42 #include "ui/views/widget/drop_helper.h" |
| 43 #include "ui/views/widget/focus_manager_event_handler.h" | 43 #include "ui/views/widget/focus_manager_event_handler.h" |
| 44 #include "ui/views/widget/native_widget_delegate.h" | 44 #include "ui/views/widget/native_widget_delegate.h" |
| 45 #include "ui/views/widget/root_view.h" | 45 #include "ui/views/widget/root_view.h" |
| 46 #include "ui/views/widget/tooltip_manager_aura.h" | 46 #include "ui/views/widget/tooltip_manager_aura.h" |
| 47 #include "ui/views/widget/widget_aura_utils.h" | 47 #include "ui/views/widget/widget_aura_utils.h" |
| 48 #include "ui/views/widget/widget_delegate.h" | 48 #include "ui/views/widget/widget_delegate.h" |
| 49 #include "ui/views/widget/window_reorderer.h" | 49 #include "ui/views/widget/window_reorderer.h" |
| 50 #include "ui/wm/core/shadow_types.h" | 50 #include "ui/wm/core/shadow_types.h" |
| 51 #include "ui/wm/core/transient_window_manager.h" |
| 51 #include "ui/wm/core/window_animations.h" | 52 #include "ui/wm/core/window_animations.h" |
| 52 #include "ui/wm/core/window_util.h" | 53 #include "ui/wm/core/window_util.h" |
| 53 #include "ui/wm/public/activation_client.h" | 54 #include "ui/wm/public/activation_client.h" |
| 54 #include "ui/wm/public/window_move_client.h" | 55 #include "ui/wm/public/window_move_client.h" |
| 55 #include "ui/wm/public/window_types.h" | 56 #include "ui/wm/public/window_types.h" |
| 56 | 57 |
| 57 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 58 #include "base/win/scoped_gdi_object.h" | 59 #include "base/win/scoped_gdi_object.h" |
| 59 #include "base/win/win_util.h" | 60 #include "base/win/win_util.h" |
| 60 #include "ui/base/l10n/l10n_util_win.h" | 61 #include "ui/base/l10n/l10n_util_win.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 gfx::NativeView parent = params.parent; | 175 gfx::NativeView parent = params.parent; |
| 175 gfx::NativeView context = params.context; | 176 gfx::NativeView context = params.context; |
| 176 if (!params.child) { | 177 if (!params.child) { |
| 177 // Set up the transient child before the window is added. This way the | 178 // Set up the transient child before the window is added. This way the |
| 178 // LayoutManager knows the window has a transient parent. | 179 // LayoutManager knows the window has a transient parent. |
| 179 if (parent && parent->type() != ui::wm::WINDOW_TYPE_UNKNOWN) { | 180 if (parent && parent->type() != ui::wm::WINDOW_TYPE_UNKNOWN) { |
| 180 wm::AddTransientChild(parent, window_); | 181 wm::AddTransientChild(parent, window_); |
| 181 if (!context) | 182 if (!context) |
| 182 context = parent; | 183 context = parent; |
| 183 parent = NULL; | 184 parent = NULL; |
| 185 |
| 186 // Generally transient bubbles are showing state associated to the parent |
| 187 // window. Make sure the transient bubble is only visible if the parent is |
| 188 // visible, otherwise the bubble may not make sense by itself. |
| 189 if (params.type == Widget::InitParams::TYPE_BUBBLE) { |
| 190 wm::TransientWindowManager::Get(window_) |
| 191 ->set_parent_controls_visibility(true); |
| 192 } |
| 184 } | 193 } |
| 185 // SetAlwaysOnTop before SetParent so that always-on-top container is used. | 194 // SetAlwaysOnTop before SetParent so that always-on-top container is used. |
| 186 SetAlwaysOnTop(params.keep_on_top); | 195 SetAlwaysOnTop(params.keep_on_top); |
| 187 // Make sure we have a real |window_bounds|. | 196 // Make sure we have a real |window_bounds|. |
| 188 if (parent && window_bounds == gfx::Rect()) { | 197 if (parent && window_bounds == gfx::Rect()) { |
| 189 // If a parent is specified but no bounds are given, | 198 // If a parent is specified but no bounds are given, |
| 190 // use the origin of the parent's display so that the widget | 199 // use the origin of the parent's display so that the widget |
| 191 // will be added to the same display as the parent. | 200 // will be added to the same display as the parent. |
| 192 gfx::Rect bounds = display::Screen::GetScreen() | 201 gfx::Rect bounds = display::Screen::GetScreen() |
| 193 ->GetDisplayNearestWindow(parent) | 202 ->GetDisplayNearestWindow(parent) |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 gfx::NativeView native_view) { | 1198 gfx::NativeView native_view) { |
| 1190 aura::client::CaptureClient* capture_client = | 1199 aura::client::CaptureClient* capture_client = |
| 1191 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1200 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1192 if (!capture_client) | 1201 if (!capture_client) |
| 1193 return nullptr; | 1202 return nullptr; |
| 1194 return capture_client->GetGlobalCaptureWindow(); | 1203 return capture_client->GetGlobalCaptureWindow(); |
| 1195 } | 1204 } |
| 1196 | 1205 |
| 1197 } // namespace internal | 1206 } // namespace internal |
| 1198 } // namespace views | 1207 } // namespace views |
| OLD | NEW |