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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 } | 229 } |
| 230 | 230 |
| 231 // static | 231 // static |
| 232 aura::Window* Shell::GetPrimaryRootWindow() { | 232 aura::Window* Shell::GetPrimaryRootWindow() { |
| 233 CHECK(HasInstance()); | 233 CHECK(HasInstance()); |
| 234 return GetInstance()->window_tree_host_manager()->GetPrimaryRootWindow(); | 234 return GetInstance()->window_tree_host_manager()->GetPrimaryRootWindow(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 // static | 237 // static |
| 238 aura::Window* Shell::GetTargetRootWindow() { | 238 aura::Window* Shell::GetTargetRootWindow() { |
| 239 CHECK(HasInstance()); | 239 CHECK(WmShell::HasInstance()); |
| 240 Shell* shell = GetInstance(); | 240 return WmWindowAura::GetAuraWindow( |
| 241 if (shell->scoped_target_root_window_) | 241 WmShell::Get()->root_window_for_new_windows()); |
| 242 return shell->scoped_target_root_window_; | |
| 243 return shell->target_root_window_; | |
| 244 } | 242 } |
| 245 | 243 |
| 246 // static | 244 // static |
| 247 int64_t Shell::GetTargetDisplayId() { | 245 int64_t Shell::GetTargetDisplayId() { |
| 248 return display::Screen::GetScreen() | 246 return display::Screen::GetScreen() |
| 249 ->GetDisplayNearestWindow(GetTargetRootWindow()) | 247 ->GetDisplayNearestWindow(GetTargetRootWindow()) |
| 250 .id(); | 248 .id(); |
| 251 } | 249 } |
| 252 | 250 |
| 253 // static | 251 // static |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 return GetPrimaryRootWindowController() | 532 return GetPrimaryRootWindowController() |
| 535 ->workspace_controller() | 533 ->workspace_controller() |
| 536 ->DoInitialAnimation(); | 534 ->DoInitialAnimation(); |
| 537 } | 535 } |
| 538 | 536 |
| 539 //////////////////////////////////////////////////////////////////////////////// | 537 //////////////////////////////////////////////////////////////////////////////// |
| 540 // Shell, private: | 538 // Shell, private: |
| 541 | 539 |
| 542 Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool) | 540 Shell::Shell(ShellDelegate* delegate, base::SequencedWorkerPool* blocking_pool) |
| 543 : wm_shell_(new WmShellAura(base::WrapUnique(delegate))), | 541 : wm_shell_(new WmShellAura(base::WrapUnique(delegate))), |
| 544 target_root_window_(nullptr), | |
| 545 scoped_target_root_window_(nullptr), | |
| 546 link_handler_model_factory_(nullptr), | 542 link_handler_model_factory_(nullptr), |
| 547 activation_client_(nullptr), | 543 activation_client_(nullptr), |
| 548 #if defined(OS_CHROMEOS) | 544 #if defined(OS_CHROMEOS) |
| 549 display_configurator_(new ui::DisplayConfigurator()), | 545 display_configurator_(new ui::DisplayConfigurator()), |
| 550 #endif // defined(OS_CHROMEOS) | 546 #endif // defined(OS_CHROMEOS) |
| 551 native_cursor_manager_(nullptr), | 547 native_cursor_manager_(nullptr), |
| 552 simulate_modal_window_open_for_testing_(false), | 548 simulate_modal_window_open_for_testing_(false), |
| 553 is_touch_hud_projection_enabled_(false), | 549 is_touch_hud_projection_enabled_(false), |
| 554 blocking_pool_(blocking_pool) { | 550 blocking_pool_(blocking_pool) { |
| 555 DCHECK(aura::Env::GetInstanceDontCreate()); | 551 DCHECK(aura::Env::GetInstanceDontCreate()); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 | 817 |
| 822 env_filter_.reset(new ::wm::CompoundEventFilter); | 818 env_filter_.reset(new ::wm::CompoundEventFilter); |
| 823 AddPreTargetHandler(env_filter_.get()); | 819 AddPreTargetHandler(env_filter_.get()); |
| 824 | 820 |
| 825 wm::AshFocusRules* focus_rules = new wm::AshFocusRules(); | 821 wm::AshFocusRules* focus_rules = new wm::AshFocusRules(); |
| 826 | 822 |
| 827 ::wm::FocusController* focus_controller = | 823 ::wm::FocusController* focus_controller = |
| 828 new ::wm::FocusController(focus_rules); | 824 new ::wm::FocusController(focus_rules); |
| 829 focus_client_.reset(focus_controller); | 825 focus_client_.reset(focus_controller); |
| 830 activation_client_ = focus_controller; | 826 activation_client_ = focus_controller; |
| 831 activation_client_->AddObserver(this); | |
| 832 | 827 |
| 833 screen_position_controller_.reset(new ScreenPositionController); | 828 screen_position_controller_.reset(new ScreenPositionController); |
| 834 | 829 |
| 835 window_tree_host_manager_->Start(); | 830 window_tree_host_manager_->Start(); |
| 836 window_tree_host_manager_->CreatePrimaryHost( | 831 window_tree_host_manager_->CreatePrimaryHost( |
| 837 ShellInitParamsToAshWindowTreeHostInitParams(init_params)); | 832 ShellInitParamsToAshWindowTreeHostInitParams(init_params)); |
| 838 aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow(); | 833 aura::Window* root_window = window_tree_host_manager_->GetPrimaryRootWindow(); |
| 839 target_root_window_ = root_window; | 834 wm_shell_->set_root_window_for_new_windows(WmWindowAura::Get(root_window)); |
|
msw
2016/08/02 01:04:50
optional nit: if (!in_mus())? (it may be okay to d
James Cook
2016/08/02 16:16:04
I think it's OK to do this regardless.
| |
| 840 | 835 |
| 841 #if defined(OS_CHROMEOS) | 836 #if defined(OS_CHROMEOS) |
| 842 resolution_notification_controller_.reset( | 837 resolution_notification_controller_.reset( |
| 843 new ResolutionNotificationController); | 838 new ResolutionNotificationController); |
| 844 #endif | 839 #endif |
| 845 | 840 |
| 846 if (cursor_manager_) | 841 if (cursor_manager_) |
| 847 cursor_manager_->SetDisplay( | 842 cursor_manager_->SetDisplay( |
| 848 display::Screen::GetScreen()->GetPrimaryDisplay()); | 843 display::Screen::GetScreen()->GetPrimaryDisplay()); |
| 849 | 844 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 | 1071 |
| 1077 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { | 1072 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { |
| 1078 return std::unique_ptr<ui::EventTargetIterator>(); | 1073 return std::unique_ptr<ui::EventTargetIterator>(); |
| 1079 } | 1074 } |
| 1080 | 1075 |
| 1081 ui::EventTargeter* Shell::GetEventTargeter() { | 1076 ui::EventTargeter* Shell::GetEventTargeter() { |
| 1082 NOTREACHED(); | 1077 NOTREACHED(); |
| 1083 return nullptr; | 1078 return nullptr; |
| 1084 } | 1079 } |
| 1085 | 1080 |
| 1086 //////////////////////////////////////////////////////////////////////////////// | |
| 1087 // Shell, aura::client::ActivationChangeObserver implementation: | |
| 1088 | |
| 1089 void Shell::OnWindowActivated( | |
| 1090 aura::client::ActivationChangeObserver::ActivationReason reason, | |
| 1091 aura::Window* gained_active, | |
| 1092 aura::Window* lost_active) { | |
| 1093 if (gained_active) | |
| 1094 target_root_window_ = gained_active->GetRootWindow(); | |
| 1095 } | |
| 1096 | |
| 1097 } // namespace ash | 1081 } // namespace ash |
| OLD | NEW |