| 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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 GetWidget()->SetInitialFocus(state); | 789 GetWidget()->SetInitialFocus(state); |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 | 792 |
| 793 bool NativeWidgetMus::IsVisible() const { | 793 bool NativeWidgetMus::IsVisible() const { |
| 794 // TODO(beng): this should probably be wired thru PlatformWindow. | 794 // TODO(beng): this should probably be wired thru PlatformWindow. |
| 795 return window_ && window_->visible(); | 795 return window_ && window_->visible(); |
| 796 } | 796 } |
| 797 | 797 |
| 798 void NativeWidgetMus::Activate() { | 798 void NativeWidgetMus::Activate() { |
| 799 if (window_tree_host_) | 799 if (window_) |
| 800 window_tree_host_->platform_window()->Activate(); | 800 window_->SetFocus(); |
| 801 } | 801 } |
| 802 | 802 |
| 803 void NativeWidgetMus::Deactivate() { | 803 void NativeWidgetMus::Deactivate() { |
| 804 if (IsActive()) | 804 if (IsActive()) |
| 805 window_->connection()->ClearFocus(); | 805 window_->connection()->ClearFocus(); |
| 806 } | 806 } |
| 807 | 807 |
| 808 bool NativeWidgetMus::IsActive() const { | 808 bool NativeWidgetMus::IsActive() const { |
| 809 mus::Window* focused = | 809 mus::Window* focused = |
| 810 window_ ? window_->connection()->GetFocusedWindow() : nullptr; | 810 window_ ? window_->connection()->GetFocusedWindow() : nullptr; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 window_tree_host_->Show(); | 1121 window_tree_host_->Show(); |
| 1122 GetNativeWindow()->Show(); | 1122 GetNativeWindow()->Show(); |
| 1123 } else { | 1123 } else { |
| 1124 window_tree_host_->Hide(); | 1124 window_tree_host_->Hide(); |
| 1125 GetNativeWindow()->Hide(); | 1125 GetNativeWindow()->Hide(); |
| 1126 } | 1126 } |
| 1127 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); | 1127 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 } // namespace views | 1130 } // namespace views |
| OLD | NEW |