Chromium Code Reviews| 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/desktop_aura/desktop_window_tree_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
| 6 | 6 |
| 7 #include "base/win/metro.h" | 7 #include "base/win/metro.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 } | 89 } |
| 90 | 90 |
| 91 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { | 91 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { |
| 92 // WARNING: |content_window_| has been destroyed by the time we get here. | 92 // WARNING: |content_window_| has been destroyed by the time we get here. |
| 93 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); | 93 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); |
| 94 DestroyDispatcher(); | 94 DestroyDispatcher(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { | 98 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { |
| 99 // All HWND's we create should have WindowTreeHost instances associated with | |
|
sky
2016/01/13 16:31:13
Is this change related?
ananta
2016/01/13 21:34:47
All HWND's created by views have WindowTreeHost in
| |
| 100 // them. There are exceptions like the content layer creating HWND's which | |
| 101 // are not associated with WindowTreeHost instances. In such cases we should | |
| 102 // try and find the WindowTreeHost associated with the parent. | |
| 99 aura::WindowTreeHost* host = | 103 aura::WindowTreeHost* host = |
| 100 aura::WindowTreeHost::GetForAcceleratedWidget(hwnd); | 104 aura::WindowTreeHost::GetForAcceleratedWidget(hwnd); |
| 105 if (!host) | |
| 106 host = aura::WindowTreeHost::GetForAcceleratedWidget(::GetParent(hwnd)); | |
| 101 return host ? host->window()->GetProperty(kContentWindowForRootWindow) : NULL; | 107 return host ? host->window()->GetProperty(kContentWindowForRootWindow) : NULL; |
| 102 } | 108 } |
| 103 | 109 |
| 104 // static | 110 // static |
| 105 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { | 111 ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { |
| 106 // Use NativeThemeWin for windows shown on the desktop, those not on the | 112 // Use NativeThemeWin for windows shown on the desktop, those not on the |
| 107 // desktop come from Ash and get NativeThemeAura. | 113 // desktop come from Ash and get NativeThemeAura. |
| 108 aura::WindowTreeHost* host = window ? window->GetHost() : NULL; | 114 aura::WindowTreeHost* host = window ? window->GetHost() : NULL; |
| 109 if (host) { | 115 if (host) { |
| 110 HWND host_hwnd = host->GetAcceleratedWidget(); | 116 HWND host_hwnd = host->GetAcceleratedWidget(); |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 958 | 964 |
| 959 // static | 965 // static |
| 960 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 966 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 961 internal::NativeWidgetDelegate* native_widget_delegate, | 967 internal::NativeWidgetDelegate* native_widget_delegate, |
| 962 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 968 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 963 return new DesktopWindowTreeHostWin(native_widget_delegate, | 969 return new DesktopWindowTreeHostWin(native_widget_delegate, |
| 964 desktop_native_widget_aura); | 970 desktop_native_widget_aura); |
| 965 } | 971 } |
| 966 | 972 |
| 967 } // namespace views | 973 } // namespace views |
| OLD | NEW |