| 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_root_window_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
| 6 | 6 |
| 7 #include "third_party/skia/include/core/SkPath.h" | 7 #include "third_party/skia/include/core/SkPath.h" |
| 8 #include "third_party/skia/include/core/SkRegion.h" | 8 #include "third_party/skia/include/core/SkRegion.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/focus_manager.h" | 10 #include "ui/aura/focus_manager.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 DesktopRootWindowHostWin::DesktopRootWindowHostWin( | 51 DesktopRootWindowHostWin::DesktopRootWindowHostWin( |
| 52 internal::NativeWidgetDelegate* native_widget_delegate, | 52 internal::NativeWidgetDelegate* native_widget_delegate, |
| 53 DesktopNativeWidgetAura* desktop_native_widget_aura, | 53 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 54 const gfx::Rect& initial_bounds) | 54 const gfx::Rect& initial_bounds) |
| 55 : ALLOW_THIS_IN_INITIALIZER_LIST( | 55 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 56 message_handler_(new HWNDMessageHandler(this))), | 56 message_handler_(new HWNDMessageHandler(this))), |
| 57 native_widget_delegate_(native_widget_delegate), | 57 native_widget_delegate_(native_widget_delegate), |
| 58 desktop_native_widget_aura_(desktop_native_widget_aura), | 58 desktop_native_widget_aura_(desktop_native_widget_aura), |
| 59 root_window_host_delegate_(NULL), | 59 root_window_host_delegate_(NULL), |
| 60 content_window_(NULL), | 60 content_window_(NULL), |
| 61 should_animate_window_close_(false), | |
| 62 pending_close_(false) { | 61 pending_close_(false) { |
| 63 } | 62 } |
| 64 | 63 |
| 65 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { | 64 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { |
| 66 if (corewm::UseFocusControllerOnDesktop()) { | 65 if (corewm::UseFocusControllerOnDesktop()) { |
| 67 aura::client::SetFocusClient(root_window_, NULL); | 66 aura::client::SetFocusClient(root_window_, NULL); |
| 68 aura::client::SetActivationClient(root_window_, NULL); | 67 aura::client::SetActivationClient(root_window_, NULL); |
| 69 } | 68 } |
| 70 } | 69 } |
| 71 | 70 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 164 |
| 166 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, | 165 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, |
| 167 GetHWND())); | 166 GetHWND())); |
| 168 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); | 167 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); |
| 169 | 168 |
| 170 focus_client_->FocusWindow(content_window_); | 169 focus_client_->FocusWindow(content_window_); |
| 171 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); | 170 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); |
| 172 | 171 |
| 173 aura::client::SetAnimationHost(content_window_, this); | 172 aura::client::SetAnimationHost(content_window_, this); |
| 174 | 173 |
| 175 should_animate_window_close_ = | |
| 176 content_window_->type() != aura::client::WINDOW_TYPE_NORMAL && | |
| 177 !views::corewm::WindowAnimationsDisabled(content_window_); | |
| 178 | |
| 179 return root_window_; | 174 return root_window_; |
| 180 } | 175 } |
| 181 | 176 |
| 182 void DesktopRootWindowHostWin::InitFocus(aura::Window* window) { | 177 void DesktopRootWindowHostWin::InitFocus(aura::Window* window) { |
| 183 focus_client_->FocusWindow(window); | 178 focus_client_->FocusWindow(window); |
| 184 } | 179 } |
| 185 | 180 |
| 181 bool DesktopRootWindowHostWin::SetCloseOnHideCompletion() { |
| 182 bool should_animate_window_close = |
| 183 content_window_->type() != aura::client::WINDOW_TYPE_NORMAL && |
| 184 !views::corewm::WindowAnimationsDisabled(content_window_); |
| 185 |
| 186 // OnWindowHidingAnimationCompleted will do a Close if this is set. |
| 187 pending_close_ = should_animate_window_close; |
| 188 return pending_close_; |
| 189 } |
| 190 |
| 186 void DesktopRootWindowHostWin::Close() { | 191 void DesktopRootWindowHostWin::Close() { |
| 187 if (should_animate_window_close_) { | 192 message_handler_->Close(); |
| 188 pending_close_ = true; | |
| 189 // OnWindowHidingAnimationCompleted does the actual Close. | |
| 190 content_window_->Hide(); | |
| 191 } else { | |
| 192 message_handler_->Close(); | |
| 193 } | |
| 194 } | 193 } |
| 195 | 194 |
| 196 void DesktopRootWindowHostWin::CloseNow() { | 195 void DesktopRootWindowHostWin::CloseNow() { |
| 197 message_handler_->CloseNow(); | 196 message_handler_->CloseNow(); |
| 198 } | 197 } |
| 199 | 198 |
| 200 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() { | 199 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() { |
| 201 return this; | 200 return this; |
| 202 } | 201 } |
| 203 | 202 |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 833 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 835 internal::NativeWidgetDelegate* native_widget_delegate, | 834 internal::NativeWidgetDelegate* native_widget_delegate, |
| 836 DesktopNativeWidgetAura* desktop_native_widget_aura, | 835 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 837 const gfx::Rect& initial_bounds) { | 836 const gfx::Rect& initial_bounds) { |
| 838 return new DesktopRootWindowHostWin(native_widget_delegate, | 837 return new DesktopRootWindowHostWin(native_widget_delegate, |
| 839 desktop_native_widget_aura, | 838 desktop_native_widget_aura, |
| 840 initial_bounds); | 839 initial_bounds); |
| 841 } | 840 } |
| 842 | 841 |
| 843 } // namespace views | 842 } // namespace views |
| OLD | NEW |