| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/simple_wm/simple_wm.h" | 5 #include "mash/simple_wm/simple_wm.h" |
| 6 | 6 |
| 7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "mash/simple_wm/move_event_handler.h" | 9 #include "mash/simple_wm/move_event_handler.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 SimpleWM::SimpleWM() {} | 347 SimpleWM::SimpleWM() {} |
| 348 | 348 |
| 349 SimpleWM::~SimpleWM() { | 349 SimpleWM::~SimpleWM() { |
| 350 // WindowTreeHost uses state from WindowTreeClient, so destroy it first. | 350 // WindowTreeHost uses state from WindowTreeClient, so destroy it first. |
| 351 window_tree_host_.reset(); | 351 window_tree_host_.reset(); |
| 352 | 352 |
| 353 // WindowTreeClient destruction may callback to us. | 353 // WindowTreeClient destruction may callback to us. |
| 354 window_tree_client_.reset(); | 354 window_tree_client_.reset(); |
| 355 | 355 |
| 356 gpu_.reset(); | |
| 357 | |
| 358 display::Screen::SetScreenInstance(nullptr); | 356 display::Screen::SetScreenInstance(nullptr); |
| 359 } | 357 } |
| 360 | 358 |
| 361 //////////////////////////////////////////////////////////////////////////////// | 359 //////////////////////////////////////////////////////////////////////////////// |
| 362 // SimpleWM, service_manager::Service implementation: | 360 // SimpleWM, service_manager::Service implementation: |
| 363 | 361 |
| 364 void SimpleWM::OnStart() { | 362 void SimpleWM::OnStart() { |
| 365 CHECK(!started_); | 363 CHECK(!started_); |
| 366 started_ = true; | 364 started_ = true; |
| 367 screen_ = base::MakeUnique<display::ScreenBase>(); | 365 screen_ = base::MakeUnique<display::ScreenBase>(); |
| 368 display::Screen::SetScreenInstance(screen_.get()); | 366 display::Screen::SetScreenInstance(screen_.get()); |
| 369 aura_init_ = base::MakeUnique<views::AuraInit>( | 367 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 370 context()->connector(), context()->identity(), "views_mus_resources.pak", | 368 context()->connector(), context()->identity(), "views_mus_resources.pak", |
| 371 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); | 369 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); |
| 372 gpu_ = ui::Gpu::Create(context()->connector(), nullptr); | |
| 373 compositor_context_factory_ = | |
| 374 base::MakeUnique<aura::MusContextFactory>(gpu_.get()); | |
| 375 aura::Env::GetInstance()->set_context_factory( | |
| 376 compositor_context_factory_.get()); | |
| 377 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>( | 370 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>( |
| 378 context()->connector(), this, this); | 371 context()->connector(), this, this); |
| 379 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); | 372 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); |
| 380 window_tree_client_->ConnectAsWindowManager(); | 373 window_tree_client_->ConnectAsWindowManager(); |
| 381 } | 374 } |
| 382 | 375 |
| 383 bool SimpleWM::OnConnect( | 376 bool SimpleWM::OnConnect( |
| 384 const service_manager::ServiceInfo& remote_info, | 377 const service_manager::ServiceInfo& remote_info, |
| 385 service_manager::InterfaceRegistry* registry) { | 378 service_manager::InterfaceRegistry* registry) { |
| 386 return true; | 379 return true; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 } | 584 } |
| 592 | 585 |
| 593 void SimpleWM::OnWindowListViewItemActivated(aura::Window* window) { | 586 void SimpleWM::OnWindowListViewItemActivated(aura::Window* window) { |
| 594 window->Show(); | 587 window->Show(); |
| 595 aura::client::ActivationClient* activation_client = | 588 aura::client::ActivationClient* activation_client = |
| 596 aura::client::GetActivationClient(window->GetRootWindow()); | 589 aura::client::GetActivationClient(window->GetRootWindow()); |
| 597 activation_client->ActivateWindow(window); | 590 activation_client->ActivateWindow(window); |
| 598 } | 591 } |
| 599 | 592 |
| 600 } // namespace simple_wm | 593 } // namespace simple_wm |
| OLD | NEW |