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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/display/screen_base.h" | 9 #include "ui/display/screen_base.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 SimpleWM::SimpleWM() {} | 66 SimpleWM::SimpleWM() {} |
67 | 67 |
68 SimpleWM::~SimpleWM() { | 68 SimpleWM::~SimpleWM() { |
69 // WindowTreeHost uses state from WindowTreeClient, so destroy it first. | 69 // WindowTreeHost uses state from WindowTreeClient, so destroy it first. |
70 window_tree_host_.reset(); | 70 window_tree_host_.reset(); |
71 | 71 |
72 // WindowTreeClient destruction may callback to us. | 72 // WindowTreeClient destruction may callback to us. |
73 window_tree_client_.reset(); | 73 window_tree_client_.reset(); |
74 | 74 |
75 gpu_service_.reset(); | 75 gpu_.reset(); |
76 | 76 |
77 display::Screen::SetScreenInstance(nullptr); | 77 display::Screen::SetScreenInstance(nullptr); |
78 } | 78 } |
79 | 79 |
80 void SimpleWM::OnStart() { | 80 void SimpleWM::OnStart() { |
81 CHECK(!started_); | 81 CHECK(!started_); |
82 started_ = true; | 82 started_ = true; |
83 screen_ = base::MakeUnique<display::ScreenBase>(); | 83 screen_ = base::MakeUnique<display::ScreenBase>(); |
84 display::Screen::SetScreenInstance(screen_.get()); | 84 display::Screen::SetScreenInstance(screen_.get()); |
85 aura_init_ = base::MakeUnique<views::AuraInit>( | 85 aura_init_ = base::MakeUnique<views::AuraInit>( |
86 context()->connector(), context()->identity(), "views_mus_resources.pak", | 86 context()->connector(), context()->identity(), "views_mus_resources.pak", |
87 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); | 87 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); |
88 gpu_service_ = ui::GpuService::Create(context()->connector(), nullptr); | 88 gpu_ = ui::Gpu::Create(context()->connector(), nullptr); |
89 compositor_context_factory_ = | 89 compositor_context_factory_ = |
90 base::MakeUnique<aura::MusContextFactory>(gpu_service_.get()); | 90 base::MakeUnique<aura::MusContextFactory>(gpu_.get()); |
91 aura::Env::GetInstance()->set_context_factory( | 91 aura::Env::GetInstance()->set_context_factory( |
92 compositor_context_factory_.get()); | 92 compositor_context_factory_.get()); |
93 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>( | 93 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>( |
94 context()->connector(), this, this); | 94 context()->connector(), this, this); |
95 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); | 95 aura::Env::GetInstance()->SetWindowTreeClient(window_tree_client_.get()); |
96 window_tree_client_->ConnectAsWindowManager(); | 96 window_tree_client_->ConnectAsWindowManager(); |
97 } | 97 } |
98 | 98 |
99 bool SimpleWM::OnConnect( | 99 bool SimpleWM::OnConnect( |
100 const service_manager::ServiceInfo& remote_info, | 100 const service_manager::ServiceInfo& remote_info, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 const std::vector<gfx::Rect>& additional_client_areas) {} | 236 const std::vector<gfx::Rect>& additional_client_areas) {} |
237 | 237 |
238 SimpleWM::FrameView* SimpleWM::GetFrameViewForClientWindow( | 238 SimpleWM::FrameView* SimpleWM::GetFrameViewForClientWindow( |
239 aura::Window* client_window) { | 239 aura::Window* client_window) { |
240 auto it = client_window_to_frame_view_.find(client_window); | 240 auto it = client_window_to_frame_view_.find(client_window); |
241 return it != client_window_to_frame_view_.end() ? it->second : nullptr; | 241 return it != client_window_to_frame_view_.end() ? it->second : nullptr; |
242 } | 242 } |
243 | 243 |
244 } // namespace simple_wm | 244 } // namespace simple_wm |
245 | 245 |
OLD | NEW |