| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "components/mus/public/cpp/property_type_converters.h" | 9 #include "components/mus/public/cpp/property_type_converters.h" |
| 10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // TODO(beng): this should probably be wired thru PlatformWindow. | 683 // TODO(beng): this should probably be wired thru PlatformWindow. |
| 684 return window_ && window_->visible(); | 684 return window_ && window_->visible(); |
| 685 } | 685 } |
| 686 | 686 |
| 687 void NativeWidgetMus::Activate() { | 687 void NativeWidgetMus::Activate() { |
| 688 if (window_tree_host_) | 688 if (window_tree_host_) |
| 689 window_tree_host_->platform_window()->Activate(); | 689 window_tree_host_->platform_window()->Activate(); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void NativeWidgetMus::Deactivate() { | 692 void NativeWidgetMus::Deactivate() { |
| 693 // NOTIMPLEMENTED(); | 693 if (IsActive()) |
| 694 window_->connection()->ClearFocus(); |
| 694 } | 695 } |
| 695 | 696 |
| 696 bool NativeWidgetMus::IsActive() const { | 697 bool NativeWidgetMus::IsActive() const { |
| 697 // NOTIMPLEMENTED(); | 698 mus::Window* focused = |
| 698 return true; | 699 window_ ? window_->connection()->GetFocusedWindow() : nullptr; |
| 700 return focused && window_->Contains(focused); |
| 699 } | 701 } |
| 700 | 702 |
| 701 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) { | 703 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) { |
| 702 // NOTIMPLEMENTED(); | 704 // NOTIMPLEMENTED(); |
| 703 } | 705 } |
| 704 | 706 |
| 705 bool NativeWidgetMus::IsAlwaysOnTop() const { | 707 bool NativeWidgetMus::IsAlwaysOnTop() const { |
| 706 // NOTIMPLEMENTED(); | 708 // NOTIMPLEMENTED(); |
| 707 return false; | 709 return false; |
| 708 } | 710 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 window_tree_host_->platform_window()->SetCursorById( | 802 window_tree_host_->platform_window()->SetCursorById( |
| 801 mus::mojom::Cursor(cursor.native_type())); | 803 mus::mojom::Cursor(cursor.native_type())); |
| 802 } | 804 } |
| 803 | 805 |
| 804 bool NativeWidgetMus::IsMouseEventsEnabled() const { | 806 bool NativeWidgetMus::IsMouseEventsEnabled() const { |
| 805 // NOTIMPLEMENTED(); | 807 // NOTIMPLEMENTED(); |
| 806 return true; | 808 return true; |
| 807 } | 809 } |
| 808 | 810 |
| 809 void NativeWidgetMus::ClearNativeFocus() { | 811 void NativeWidgetMus::ClearNativeFocus() { |
| 810 // NOTIMPLEMENTED(); | 812 if (!IsActive()) |
| 813 return; |
| 814 mus::Window* focused = |
| 815 window_ ? window_->connection()->GetFocusedWindow() : nullptr; |
| 816 if (focused && window_->Contains(focused) && focused != window_) |
| 817 window_->SetFocus(); |
| 811 } | 818 } |
| 812 | 819 |
| 813 gfx::Rect NativeWidgetMus::GetWorkAreaBoundsInScreen() const { | 820 gfx::Rect NativeWidgetMus::GetWorkAreaBoundsInScreen() const { |
| 814 // NOTIMPLEMENTED(); | 821 // NOTIMPLEMENTED(); |
| 815 return gfx::Rect(); | 822 return gfx::Rect(); |
| 816 } | 823 } |
| 817 | 824 |
| 818 Widget::MoveLoopResult NativeWidgetMus::RunMoveLoop( | 825 Widget::MoveLoopResult NativeWidgetMus::RunMoveLoop( |
| 819 const gfx::Vector2d& drag_offset, | 826 const gfx::Vector2d& drag_offset, |
| 820 Widget::MoveLoopSource source, | 827 Widget::MoveLoopSource source, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 window_tree_host_->Show(); | 1005 window_tree_host_->Show(); |
| 999 GetNativeWindow()->Show(); | 1006 GetNativeWindow()->Show(); |
| 1000 } else { | 1007 } else { |
| 1001 window_tree_host_->Hide(); | 1008 window_tree_host_->Hide(); |
| 1002 GetNativeWindow()->Hide(); | 1009 GetNativeWindow()->Hide(); |
| 1003 } | 1010 } |
| 1004 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); | 1011 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); |
| 1005 } | 1012 } |
| 1006 | 1013 |
| 1007 } // namespace views | 1014 } // namespace views |
| OLD | NEW |