Chromium Code Reviews| 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 return root_window ? root_window->GetRootWindowController() : nullptr; | 237 return root_window ? root_window->GetRootWindowController() : nullptr; |
| 238 } | 238 } |
| 239 | 239 |
| 240 // static | 240 // static |
| 241 aura::Window* Shell::GetPrimaryRootWindow() { | 241 aura::Window* Shell::GetPrimaryRootWindow() { |
| 242 CHECK(HasInstance()); | 242 CHECK(HasInstance()); |
| 243 return instance_->wm_shell_->GetPrimaryRootWindow()->aura_window(); | 243 return instance_->wm_shell_->GetPrimaryRootWindow()->aura_window(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // static | 246 // static |
| 247 aura::Window* Shell::GetTargetRootWindow() { | 247 aura::Window* Shell::GetTargetRootWindow() { |
|
James Cook
2017/03/08 03:04:15
Hrm, though now it's confusing that we have both.
sky
2017/03/08 17:01:38
Indeed. I renamed this to GetRootWindowForNewWindo
| |
| 248 CHECK(WmShell::HasInstance()); | 248 CHECK(WmShell::HasInstance()); |
| 249 return WmWindow::GetAuraWindow(WmShell::Get()->GetRootWindowForNewWindows()); | 249 return WmWindow::GetAuraWindow( |
| 250 Shell::GetInstance()->GetRootWindowForNewWindows()); | |
| 250 } | 251 } |
| 251 | 252 |
| 252 // static | 253 // static |
| 253 int64_t Shell::GetTargetDisplayId() { | 254 int64_t Shell::GetTargetDisplayId() { |
| 254 return display::Screen::GetScreen() | 255 return display::Screen::GetScreen() |
| 255 ->GetDisplayNearestWindow(GetTargetRootWindow()) | 256 ->GetDisplayNearestWindow(GetTargetRootWindow()) |
| 256 .id(); | 257 .id(); |
| 257 } | 258 } |
| 258 | 259 |
| 259 // static | 260 // static |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 | 370 |
| 370 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 371 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 371 if (is_touch_hud_projection_enabled_ == enabled) | 372 if (is_touch_hud_projection_enabled_ == enabled) |
| 372 return; | 373 return; |
| 373 | 374 |
| 374 is_touch_hud_projection_enabled_ = enabled; | 375 is_touch_hud_projection_enabled_ = enabled; |
| 375 for (auto& observer : *wm_shell_->shell_observers()) | 376 for (auto& observer : *wm_shell_->shell_observers()) |
| 376 observer.OnTouchHudProjectionToggled(enabled); | 377 observer.OnTouchHudProjectionToggled(enabled); |
| 377 } | 378 } |
| 378 | 379 |
| 380 WmWindow* Shell::GetRootWindowForNewWindows() { | |
| 381 if (scoped_root_window_for_new_windows_) | |
| 382 return scoped_root_window_for_new_windows_; | |
| 383 return root_window_for_new_windows_; | |
| 384 } | |
| 385 | |
| 379 FirstRunHelper* Shell::CreateFirstRunHelper() { | 386 FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 380 return new FirstRunHelperImpl; | 387 return new FirstRunHelperImpl; |
| 381 } | 388 } |
| 382 | 389 |
| 383 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) { | 390 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) { |
| 384 window_tree_host_manager_->cursor_window_controller() | 391 window_tree_host_manager_->cursor_window_controller() |
| 385 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip); | 392 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip); |
| 386 } | 393 } |
| 387 | 394 |
| 388 void Shell::SetCursorCompositingEnabled(bool enabled) { | 395 void Shell::SetCursorCompositingEnabled(bool enabled) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 673 | 680 |
| 674 env_filter_.reset(new ::wm::CompoundEventFilter); | 681 env_filter_.reset(new ::wm::CompoundEventFilter); |
| 675 AddPreTargetHandler(env_filter_.get()); | 682 AddPreTargetHandler(env_filter_.get()); |
| 676 | 683 |
| 677 wm::AshFocusRules* focus_rules = new wm::AshFocusRules(); | 684 wm::AshFocusRules* focus_rules = new wm::AshFocusRules(); |
| 678 | 685 |
| 679 ::wm::FocusController* focus_controller = | 686 ::wm::FocusController* focus_controller = |
| 680 new ::wm::FocusController(focus_rules); | 687 new ::wm::FocusController(focus_rules); |
| 681 focus_client_.reset(focus_controller); | 688 focus_client_.reset(focus_controller); |
| 682 activation_client_ = focus_controller; | 689 activation_client_ = focus_controller; |
| 683 // TODO(sky): Shell should implement ActivationChangeObserver, not WmShell. | 690 activation_client_->AddObserver(this); |
|
James Cook
2017/03/08 03:04:15
Where is this observer removed?
sky
2017/03/08 17:01:38
Looking back at the history AFAICT the code never
| |
| 684 activation_client_->AddObserver(wm_shell_.get()); | |
| 685 | 691 |
| 686 screen_position_controller_.reset(new ScreenPositionController); | 692 screen_position_controller_.reset(new ScreenPositionController); |
| 687 | 693 |
| 688 wm_shell_->CreatePrimaryHost(); | 694 wm_shell_->CreatePrimaryHost(); |
| 689 wm_shell_->set_root_window_for_new_windows( | 695 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); |
| 690 WmWindow::Get(GetPrimaryRootWindow())); | |
| 691 | 696 |
| 692 if (!is_mash) { | 697 if (!is_mash) { |
| 693 resolution_notification_controller_.reset( | 698 resolution_notification_controller_.reset( |
| 694 new ResolutionNotificationController); | 699 new ResolutionNotificationController); |
| 695 } | 700 } |
| 696 | 701 |
| 697 if (cursor_manager_) { | 702 if (cursor_manager_) { |
| 698 cursor_manager_->SetDisplay( | 703 cursor_manager_->SetDisplay( |
| 699 display::Screen::GetScreen()->GetPrimaryDisplay()); | 704 display::Screen::GetScreen()->GetPrimaryDisplay()); |
| 700 } | 705 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 952 | 957 |
| 953 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { | 958 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { |
| 954 return std::unique_ptr<ui::EventTargetIterator>(); | 959 return std::unique_ptr<ui::EventTargetIterator>(); |
| 955 } | 960 } |
| 956 | 961 |
| 957 ui::EventTargeter* Shell::GetEventTargeter() { | 962 ui::EventTargeter* Shell::GetEventTargeter() { |
| 958 NOTREACHED(); | 963 NOTREACHED(); |
| 959 return nullptr; | 964 return nullptr; |
| 960 } | 965 } |
| 961 | 966 |
| 967 void Shell::OnWindowActivated( | |
| 968 aura::client::ActivationChangeObserver::ActivationReason reason, | |
| 969 aura::Window* gained_active, | |
| 970 aura::Window* lost_active) { | |
| 971 // TODO(sky): Shell should implement ActivationChangeObserver, not WmShell. | |
|
James Cook
2017/03/08 03:04:15
This TODO looks TODONE.
sky
2017/03/08 17:01:38
Done.
| |
| 972 WmWindow* gained_active_wm = WmWindow::Get(gained_active); | |
| 973 if (gained_active_wm) | |
| 974 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); | |
| 975 } | |
| 976 | |
| 962 } // namespace ash | 977 } // namespace ash |
| OLD | NEW |