| 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/threading/thread_task_runner_handle.h" | 8 #include "base/threading/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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 properties->insert(init_params.mus_properties.begin(), | 525 properties->insert(init_params.mus_properties.begin(), |
| 526 init_params.mus_properties.end()); | 526 init_params.mus_properties.end()); |
| 527 if (!init_params.bounds.IsEmpty()) { | 527 if (!init_params.bounds.IsEmpty()) { |
| 528 (*properties)[mus::mojom::WindowManager::kUserSetBounds_Property] = | 528 (*properties)[mus::mojom::WindowManager::kUserSetBounds_Property] = |
| 529 mojo::ConvertTo<std::vector<uint8_t>>(init_params.bounds); | 529 mojo::ConvertTo<std::vector<uint8_t>>(init_params.bounds); |
| 530 } | 530 } |
| 531 if (!init_params.name.empty()) { | 531 if (!init_params.name.empty()) { |
| 532 (*properties)[mus::mojom::WindowManager::kName_Property] = | 532 (*properties)[mus::mojom::WindowManager::kName_Property] = |
| 533 mojo::ConvertTo<std::vector<uint8_t>>(init_params.name); | 533 mojo::ConvertTo<std::vector<uint8_t>>(init_params.name); |
| 534 } | 534 } |
| 535 (*properties)[mus::mojom::WindowManager::kAlwaysOnTop_Property] = |
| 536 mojo::ConvertTo<std::vector<uint8_t>>(init_params.keep_on_top); |
| 535 | 537 |
| 536 if (!Widget::RequiresNonClientView(init_params.type)) | 538 if (!Widget::RequiresNonClientView(init_params.type)) |
| 537 return; | 539 return; |
| 538 | 540 |
| 539 (*properties)[mus::mojom::WindowManager::kWindowType_Property] = | 541 (*properties)[mus::mojom::WindowManager::kWindowType_Property] = |
| 540 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>( | 542 mojo::ConvertTo<std::vector<uint8_t>>(static_cast<int32_t>( |
| 541 mojo::ConvertTo<mus::mojom::WindowType>(init_params.type))); | 543 mojo::ConvertTo<mus::mojom::WindowType>(init_params.type))); |
| 542 (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = | 544 (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = |
| 543 mojo::ConvertTo<std::vector<uint8_t>>( | 545 mojo::ConvertTo<std::vector<uint8_t>>( |
| 544 ResizeBehaviorFromDelegate(init_params.delegate)); | 546 ResizeBehaviorFromDelegate(init_params.delegate)); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 window_->connection()->ClearFocus(); | 902 window_->connection()->ClearFocus(); |
| 901 } | 903 } |
| 902 | 904 |
| 903 bool NativeWidgetMus::IsActive() const { | 905 bool NativeWidgetMus::IsActive() const { |
| 904 mus::Window* focused = | 906 mus::Window* focused = |
| 905 window_ ? window_->connection()->GetFocusedWindow() : nullptr; | 907 window_ ? window_->connection()->GetFocusedWindow() : nullptr; |
| 906 return focused && window_->Contains(focused); | 908 return focused && window_->Contains(focused); |
| 907 } | 909 } |
| 908 | 910 |
| 909 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) { | 911 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) { |
| 910 // NOTIMPLEMENTED(); | 912 if (window_) { |
| 913 window_->SetSharedProperty<bool>( |
| 914 mus::mojom::WindowManager::kAlwaysOnTop_Property, always_on_top); |
| 915 } |
| 911 } | 916 } |
| 912 | 917 |
| 913 bool NativeWidgetMus::IsAlwaysOnTop() const { | 918 bool NativeWidgetMus::IsAlwaysOnTop() const { |
| 914 // NOTIMPLEMENTED(); | 919 return window_ && |
| 915 return false; | 920 window_->HasSharedProperty( |
| 921 mus::mojom::WindowManager::kAlwaysOnTop_Property) && |
| 922 window_->GetSharedProperty<bool>( |
| 923 mus::mojom::WindowManager::kAlwaysOnTop_Property); |
| 916 } | 924 } |
| 917 | 925 |
| 918 void NativeWidgetMus::SetVisibleOnAllWorkspaces(bool always_visible) { | 926 void NativeWidgetMus::SetVisibleOnAllWorkspaces(bool always_visible) { |
| 919 // NOTIMPLEMENTED(); | 927 // Not needed for chromeos. |
| 920 } | 928 } |
| 921 | 929 |
| 922 void NativeWidgetMus::Maximize() { | 930 void NativeWidgetMus::Maximize() { |
| 923 SetShowState(mus::mojom::ShowState::MAXIMIZED); | 931 SetShowState(mus::mojom::ShowState::MAXIMIZED); |
| 924 } | 932 } |
| 925 | 933 |
| 926 void NativeWidgetMus::Minimize() { | 934 void NativeWidgetMus::Minimize() { |
| 927 SetShowState(mus::mojom::ShowState::MINIMIZED); | 935 SetShowState(mus::mojom::ShowState::MINIMIZED); |
| 928 } | 936 } |
| 929 | 937 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 window_tree_host_->Show(); | 1242 window_tree_host_->Show(); |
| 1235 GetNativeWindow()->Show(); | 1243 GetNativeWindow()->Show(); |
| 1236 } else { | 1244 } else { |
| 1237 window_tree_host_->Hide(); | 1245 window_tree_host_->Hide(); |
| 1238 GetNativeWindow()->Hide(); | 1246 GetNativeWindow()->Hide(); |
| 1239 } | 1247 } |
| 1240 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); | 1248 native_widget_delegate_->OnNativeWidgetVisibilityChanged(window->visible()); |
| 1241 } | 1249 } |
| 1242 | 1250 |
| 1243 } // namespace views | 1251 } // namespace views |
| OLD | NEW |