| 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/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, | 160 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, |
| 161 GetHWND())); | 161 GetHWND())); |
| 162 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); | 162 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); |
| 163 | 163 |
| 164 focus_client_->FocusWindow(content_window_); | 164 focus_client_->FocusWindow(content_window_); |
| 165 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); | 165 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); |
| 166 | 166 |
| 167 return root_window_; | 167 return root_window_; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void DesktopRootWindowHostWin::InitFocus(aura::Window* window) { |
| 171 focus_client_->FocusWindow(window); |
| 172 } |
| 173 |
| 170 void DesktopRootWindowHostWin::Close() { | 174 void DesktopRootWindowHostWin::Close() { |
| 171 message_handler_->Close(); | 175 message_handler_->Close(); |
| 172 } | 176 } |
| 173 | 177 |
| 174 void DesktopRootWindowHostWin::CloseNow() { | 178 void DesktopRootWindowHostWin::CloseNow() { |
| 175 message_handler_->CloseNow(); | 179 message_handler_->CloseNow(); |
| 176 } | 180 } |
| 177 | 181 |
| 178 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() { | 182 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() { |
| 179 return this; | 183 return this; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 371 |
| 368 void DesktopRootWindowHostWin::Hide() { | 372 void DesktopRootWindowHostWin::Hide() { |
| 369 message_handler_->Hide(); | 373 message_handler_->Hide(); |
| 370 } | 374 } |
| 371 | 375 |
| 372 void DesktopRootWindowHostWin::ToggleFullScreen() { | 376 void DesktopRootWindowHostWin::ToggleFullScreen() { |
| 373 } | 377 } |
| 374 | 378 |
| 375 gfx::Rect DesktopRootWindowHostWin::GetBounds() const { | 379 gfx::Rect DesktopRootWindowHostWin::GetBounds() const { |
| 376 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). | 380 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). |
| 377 return WidgetSizeIsClientSize() ? | 381 gfx::Rect bounds(WidgetSizeIsClientSize() ? GetClientAreaBoundsInScreen() |
| 378 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen(); | 382 : GetWindowBoundsInScreen()); |
| 383 gfx::Rect without_expansion(bounds.x() - window_expansion_.x(), |
| 384 bounds.y() - window_expansion_.y(), |
| 385 bounds.width() - window_expansion_.width(), |
| 386 bounds.height() - window_expansion_.height()); |
| 387 return without_expansion; |
| 379 } | 388 } |
| 380 | 389 |
| 381 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { | 390 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { |
| 382 message_handler_->SetBounds(bounds); | 391 gfx::Rect expanded(bounds.x() + window_expansion_.x(), |
| 392 bounds.y() + window_expansion_.y(), |
| 393 bounds.width() + window_expansion_.width(), |
| 394 bounds.height() + window_expansion_.height()); |
| 395 message_handler_->SetBounds(expanded); |
| 383 } | 396 } |
| 384 | 397 |
| 385 gfx::Insets DesktopRootWindowHostWin::GetInsets() const { | 398 gfx::Insets DesktopRootWindowHostWin::GetInsets() const { |
| 386 return gfx::Insets(); | 399 return gfx::Insets(); |
| 387 } | 400 } |
| 388 | 401 |
| 389 void DesktopRootWindowHostWin::SetInsets(const gfx::Insets& insets) { | 402 void DesktopRootWindowHostWin::SetInsets(const gfx::Insets& insets) { |
| 390 } | 403 } |
| 391 | 404 |
| 392 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { | 405 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 const base::NativeEvent& native_event) { | 460 const base::NativeEvent& native_event) { |
| 448 } | 461 } |
| 449 | 462 |
| 450 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged( | 463 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged( |
| 451 float device_scale_factor) { | 464 float device_scale_factor) { |
| 452 } | 465 } |
| 453 | 466 |
| 454 void DesktopRootWindowHostWin::PrepareForShutdown() { | 467 void DesktopRootWindowHostWin::PrepareForShutdown() { |
| 455 } | 468 } |
| 456 | 469 |
| 470 void DesktopRootWindowHostWin::SetHostWindowExpansion(const gfx::Rect& extra) { |
| 471 gfx::Rect bounds_without_expansion = GetBounds(); |
| 472 window_expansion_ = extra; |
| 473 SetBounds(bounds_without_expansion); |
| 474 } |
| 475 |
| 457 //////////////////////////////////////////////////////////////////////////////// | 476 //////////////////////////////////////////////////////////////////////////////// |
| 458 // DesktopRootWindowHostWin, HWNDMessageHandlerDelegate implementation: | 477 // DesktopRootWindowHostWin, HWNDMessageHandlerDelegate implementation: |
| 459 | 478 |
| 460 bool DesktopRootWindowHostWin::IsWidgetWindow() const { | 479 bool DesktopRootWindowHostWin::IsWidgetWindow() const { |
| 461 return true; | 480 return true; |
| 462 } | 481 } |
| 463 | 482 |
| 464 bool DesktopRootWindowHostWin::IsUsingCustomFrame() const { | 483 bool DesktopRootWindowHostWin::IsUsingCustomFrame() const { |
| 465 return !GetWidget()->ShouldUseNativeFrame(); | 484 return !GetWidget()->ShouldUseNativeFrame(); |
| 466 } | 485 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { | 668 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { |
| 650 GetWidget()->widget_delegate()->OnWorkAreaChanged(); | 669 GetWidget()->widget_delegate()->OnWorkAreaChanged(); |
| 651 } | 670 } |
| 652 | 671 |
| 653 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { | 672 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { |
| 654 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); | 673 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); |
| 655 } | 674 } |
| 656 | 675 |
| 657 void DesktopRootWindowHostWin::HandleClientSizeChanged( | 676 void DesktopRootWindowHostWin::HandleClientSizeChanged( |
| 658 const gfx::Size& new_size) { | 677 const gfx::Size& new_size) { |
| 678 gfx::Size without_expansion(new_size.width() - window_expansion_.width(), |
| 679 new_size.height() - window_expansion_.height()); |
| 659 if (root_window_host_delegate_) | 680 if (root_window_host_delegate_) |
| 660 root_window_host_delegate_->OnHostResized(new_size); | 681 root_window_host_delegate_->OnHostResized(new_size); |
| 661 // TODO(beng): replace with a layout manager?? | 682 // TODO(beng): replace with a layout manager?? |
| 662 content_window_->SetBounds(gfx::Rect(new_size)); | 683 content_window_->SetBounds(gfx::Rect(without_expansion)); |
| 663 } | 684 } |
| 664 | 685 |
| 665 void DesktopRootWindowHostWin::HandleFrameChanged() { | 686 void DesktopRootWindowHostWin::HandleFrameChanged() { |
| 666 // Replace the frame and layout the contents. | 687 // Replace the frame and layout the contents. |
| 667 GetWidget()->non_client_view()->UpdateFrame(true); | 688 GetWidget()->non_client_view()->UpdateFrame(true); |
| 668 } | 689 } |
| 669 | 690 |
| 670 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { | 691 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { |
| 671 // TODO(beng): inform the native_widget_delegate_. | 692 // TODO(beng): inform the native_widget_delegate_. |
| 672 InputMethod* input_method = GetInputMethod(); | 693 InputMethod* input_method = GetInputMethod(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 805 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
| 785 internal::NativeWidgetDelegate* native_widget_delegate, | 806 internal::NativeWidgetDelegate* native_widget_delegate, |
| 786 DesktopNativeWidgetAura* desktop_native_widget_aura, | 807 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 787 const gfx::Rect& initial_bounds) { | 808 const gfx::Rect& initial_bounds) { |
| 788 return new DesktopRootWindowHostWin(native_widget_delegate, | 809 return new DesktopRootWindowHostWin(native_widget_delegate, |
| 789 desktop_native_widget_aura, | 810 desktop_native_widget_aura, |
| 790 initial_bounds); | 811 initial_bounds); |
| 791 } | 812 } |
| 792 | 813 |
| 793 } // namespace views | 814 } // namespace views |
| OLD | NEW |