| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 695 |
| 696 focus_client_.reset( | 696 focus_client_.reset( |
| 697 new FocusControllerMus(new FocusRulesImpl(hosted_window))); | 697 new FocusControllerMus(new FocusRulesImpl(hosted_window))); |
| 698 | 698 |
| 699 aura::client::SetFocusClient(hosted_window, focus_client_.get()); | 699 aura::client::SetFocusClient(hosted_window, focus_client_.get()); |
| 700 aura::client::SetActivationClient(hosted_window, focus_client_.get()); | 700 aura::client::SetActivationClient(hosted_window, focus_client_.get()); |
| 701 screen_position_client_.reset(new ScreenPositionClientMus(window_)); | 701 screen_position_client_.reset(new ScreenPositionClientMus(window_)); |
| 702 aura::client::SetScreenPositionClient(hosted_window, | 702 aura::client::SetScreenPositionClient(hosted_window, |
| 703 screen_position_client_.get()); | 703 screen_position_client_.get()); |
| 704 | 704 |
| 705 // TODO(erg): Remove this check when ash/mus/frame/move_event_handler.cc's | 705 // TODO(erg): Remove this check when ash/mus/move_event_handler.cc's |
| 706 // direct usage of ui::Window::SetPredefinedCursor() is switched to a | 706 // direct usage of ui::Window::SetPredefinedCursor() is switched to a |
| 707 // private method on WindowManagerClient. | 707 // private method on WindowManagerClient. |
| 708 if (!is_parallel_widget_in_window_manager()) { | 708 if (!is_parallel_widget_in_window_manager()) { |
| 709 cursor_manager_.reset(new wm::CursorManager( | 709 cursor_manager_.reset(new wm::CursorManager( |
| 710 base::WrapUnique(new NativeCursorManagerMus(window_)))); | 710 base::WrapUnique(new NativeCursorManagerMus(window_)))); |
| 711 aura::client::SetCursorClient(hosted_window, cursor_manager_.get()); | 711 aura::client::SetCursorClient(hosted_window, cursor_manager_.get()); |
| 712 } | 712 } |
| 713 | 713 |
| 714 window_tree_client_.reset(new NativeWidgetMusWindowTreeClient(hosted_window)); | 714 window_tree_client_.reset(new NativeWidgetMusWindowTreeClient(hosted_window)); |
| 715 hosted_window->AddPreTargetHandler(focus_client_.get()); | 715 hosted_window->AddPreTargetHandler(focus_client_.get()); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 window_->window_tree()->ClearFocus(); | 1035 window_->window_tree()->ClearFocus(); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 bool NativeWidgetMus::IsActive() const { | 1038 bool NativeWidgetMus::IsActive() const { |
| 1039 ui::Window* focused = | 1039 ui::Window* focused = |
| 1040 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; | 1040 window_ ? window_->window_tree()->GetFocusedWindow() : nullptr; |
| 1041 return focused && window_->Contains(focused); | 1041 return focused && window_->Contains(focused); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) { | 1044 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) { |
| 1045 if (window_) { | 1045 if (window_ && !is_parallel_widget_in_window_manager()) { |
| 1046 window_->SetSharedProperty<bool>( | 1046 window_->SetSharedProperty<bool>( |
| 1047 ui::mojom::WindowManager::kAlwaysOnTop_Property, always_on_top); | 1047 ui::mojom::WindowManager::kAlwaysOnTop_Property, always_on_top); |
| 1048 } | 1048 } |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 bool NativeWidgetMus::IsAlwaysOnTop() const { | 1051 bool NativeWidgetMus::IsAlwaysOnTop() const { |
| 1052 return window_ && | 1052 return window_ && |
| 1053 window_->HasSharedProperty( | 1053 window_->HasSharedProperty( |
| 1054 ui::mojom::WindowManager::kAlwaysOnTop_Property) && | 1054 ui::mojom::WindowManager::kAlwaysOnTop_Property) && |
| 1055 window_->GetSharedProperty<bool>( | 1055 window_->GetSharedProperty<bool>( |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 | 1434 |
| 1435 gfx::Path mask_path; | 1435 gfx::Path mask_path; |
| 1436 native_widget_delegate_->GetHitTestMask(&mask_path); | 1436 native_widget_delegate_->GetHitTestMask(&mask_path); |
| 1437 // TODO(jamescook): Use the full path for the mask. | 1437 // TODO(jamescook): Use the full path for the mask. |
| 1438 gfx::Rect mask_rect = | 1438 gfx::Rect mask_rect = |
| 1439 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1439 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
| 1440 window_->SetHitTestMask(mask_rect); | 1440 window_->SetHitTestMask(mask_rect); |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 } // namespace views | 1443 } // namespace views |
| OLD | NEW |