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 "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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); | 633 return GetWidget()->widget_delegate()->ShouldHandleSystemCommands(); |
634 } | 634 } |
635 | 635 |
636 void DesktopRootWindowHostWin::HandleAppDeactivated() { | 636 void DesktopRootWindowHostWin::HandleAppDeactivated() { |
637 native_widget_delegate_->EnableInactiveRendering(); | 637 native_widget_delegate_->EnableInactiveRendering(); |
638 } | 638 } |
639 | 639 |
640 void DesktopRootWindowHostWin::HandleActivationChanged(bool active) { | 640 void DesktopRootWindowHostWin::HandleActivationChanged(bool active) { |
641 if (active) | 641 if (active) |
642 root_window_host_delegate_->OnHostActivated(); | 642 root_window_host_delegate_->OnHostActivated(); |
643 native_widget_delegate_->OnNativeWidgetActivationChanged(active); | 643 desktop_native_widget_aura_->HandleActivationChanged(active); |
644 // If we're not active we need to deactivate the corresponding aura::Window. | |
645 // This way if a child widget is active it gets correctly deactivated (child | |
646 // widgets don't get native desktop activation changes, only aura activation | |
647 // changes). | |
648 if (!active) { | |
649 aura::client::ActivationClient* activation_client = | |
650 aura::client::GetActivationClient(root_window_); | |
651 if (activation_client) { | |
652 aura::Window* active_window = activation_client->GetActiveWindow(); | |
653 if (active_window) | |
654 activation_client->DeactivateWindow(active_window); | |
655 } | |
656 } | |
657 } | 644 } |
658 | 645 |
659 bool DesktopRootWindowHostWin::HandleAppCommand(short command) { | 646 bool DesktopRootWindowHostWin::HandleAppCommand(short command) { |
660 // We treat APPCOMMAND ids as an extension of our command namespace, and just | 647 // We treat APPCOMMAND ids as an extension of our command namespace, and just |
661 // let the delegate figure out what to do... | 648 // let the delegate figure out what to do... |
662 return GetWidget()->widget_delegate() && | 649 return GetWidget()->widget_delegate() && |
663 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); | 650 GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); |
664 } | 651 } |
665 | 652 |
666 void DesktopRootWindowHostWin::HandleCancelMode() { | 653 void DesktopRootWindowHostWin::HandleCancelMode() { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 DesktopRootWindowHost* DesktopRootWindowHost::Create( | 860 DesktopRootWindowHost* DesktopRootWindowHost::Create( |
874 internal::NativeWidgetDelegate* native_widget_delegate, | 861 internal::NativeWidgetDelegate* native_widget_delegate, |
875 DesktopNativeWidgetAura* desktop_native_widget_aura, | 862 DesktopNativeWidgetAura* desktop_native_widget_aura, |
876 const gfx::Rect& initial_bounds) { | 863 const gfx::Rect& initial_bounds) { |
877 return new DesktopRootWindowHostWin(native_widget_delegate, | 864 return new DesktopRootWindowHostWin(native_widget_delegate, |
878 desktop_native_widget_aura, | 865 desktop_native_widget_aura, |
879 initial_bounds); | 866 initial_bounds); |
880 } | 867 } |
881 | 868 |
882 } // namespace views | 869 } // namespace views |
OLD | NEW |