| 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 "ash/mus/sysui_application.h" | 5 #include "ash/mus/sysui_application.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "ash/host/ash_window_tree_host_init_params.h" | 8 #include "ash/host/ash_window_tree_host_init_params.h" |
| 9 #include "ash/host/ash_window_tree_host_platform.h" | 9 #include "ash/host/ash_window_tree_host_platform.h" |
| 10 #include "ash/mus/keyboard_ui_mus.h" | 10 #include "ash/mus/keyboard_ui_mus.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 public: | 145 public: |
| 146 AshInit() : worker_pool_(new base::SequencedWorkerPool(2, "AshWorkerPool")) { | 146 AshInit() : worker_pool_(new base::SequencedWorkerPool(2, "AshWorkerPool")) { |
| 147 ui::RegisterPathProvider(); | 147 ui::RegisterPathProvider(); |
| 148 InitializeResourceBundle(); | 148 InitializeResourceBundle(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 ~AshInit() { worker_pool_->Shutdown(); } | 151 ~AshInit() { worker_pool_->Shutdown(); } |
| 152 | 152 |
| 153 aura::Window* root() { return ash::Shell::GetPrimaryRootWindow(); } | 153 aura::Window* root() { return ash::Shell::GetPrimaryRootWindow(); } |
| 154 | 154 |
| 155 void Initialize(mojo::Shell* shell) { | 155 void Initialize(mojo::Connector* connector) { |
| 156 aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); | 156 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); |
| 157 views::WindowManagerConnection::Create(shell); | 157 views::WindowManagerConnection::Create(connector); |
| 158 | 158 |
| 159 gfx::Screen* screen = gfx::Screen::GetScreen(); | 159 gfx::Screen* screen = gfx::Screen::GetScreen(); |
| 160 DCHECK(screen); | 160 DCHECK(screen); |
| 161 gfx::Size size = screen->GetPrimaryDisplay().bounds().size(); | 161 gfx::Size size = screen->GetPrimaryDisplay().bounds().size(); |
| 162 | 162 |
| 163 // Uninstall the ScreenMus installed by WindowManagerConnection, so that ash | 163 // Uninstall the ScreenMus installed by WindowManagerConnection, so that ash |
| 164 // installs and uses the ScreenAsh. This can be removed once ash learns to | 164 // installs and uses the ScreenAsh. This can be removed once ash learns to |
| 165 // talk to mus for managing displays. | 165 // talk to mus for managing displays. |
| 166 gfx::Screen::SetScreenInstance(nullptr); | 166 gfx::Screen::SetScreenInstance(nullptr); |
| 167 | 167 |
| 168 // Install some hook so that the WindowTreeHostMus created for widgets can | 168 // Install some hook so that the WindowTreeHostMus created for widgets can |
| 169 // be hooked up correctly. | 169 // be hooked up correctly. |
| 170 native_widget_factory_.reset(new NativeWidgetFactory()); | 170 native_widget_factory_.reset(new NativeWidgetFactory()); |
| 171 | 171 |
| 172 ash::AshWindowTreeHost::SetFactory(base::Bind(&CreateWindowTreeHostMus)); | 172 ash::AshWindowTreeHost::SetFactory(base::Bind(&CreateWindowTreeHostMus)); |
| 173 ash_delegate_ = new ShellDelegateMus; | 173 ash_delegate_ = new ShellDelegateMus; |
| 174 | 174 |
| 175 InitializeComponents(); | 175 InitializeComponents(); |
| 176 | 176 |
| 177 ash::ShellInitParams init_params; | 177 ash::ShellInitParams init_params; |
| 178 init_params.delegate = ash_delegate_; | 178 init_params.delegate = ash_delegate_; |
| 179 init_params.context_factory = new StubContextFactory; | 179 init_params.context_factory = new StubContextFactory; |
| 180 init_params.blocking_pool = worker_pool_.get(); | 180 init_params.blocking_pool = worker_pool_.get(); |
| 181 init_params.in_mus = true; | 181 init_params.in_mus = true; |
| 182 init_params.keyboard_factory = base::Bind(&KeyboardUIMus::Create, shell); | 182 init_params.keyboard_factory = |
| 183 base::Bind(&KeyboardUIMus::Create, connector); |
| 183 ash::Shell::CreateInstance(init_params); | 184 ash::Shell::CreateInstance(init_params); |
| 184 ash::Shell::GetInstance()->CreateShelf(); | 185 ash::Shell::GetInstance()->CreateShelf(); |
| 185 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( | 186 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( |
| 186 ash::user::LOGGED_IN_USER); | 187 ash::user::LOGGED_IN_USER); |
| 187 | 188 |
| 188 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 189 ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 189 SetupWallpaper(SkColorSetARGB(255, 0, 255, 0)); | 190 SetupWallpaper(SkColorSetARGB(255, 0, 255, 0)); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void InitializeResourceBundle() { | 193 void InitializeResourceBundle() { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 ShellDelegateMus* ash_delegate_ = nullptr; | 248 ShellDelegateMus* ash_delegate_ = nullptr; |
| 248 scoped_ptr<NativeWidgetFactory> native_widget_factory_; | 249 scoped_ptr<NativeWidgetFactory> native_widget_factory_; |
| 249 | 250 |
| 250 DISALLOW_COPY_AND_ASSIGN(AshInit); | 251 DISALLOW_COPY_AND_ASSIGN(AshInit); |
| 251 }; | 252 }; |
| 252 | 253 |
| 253 SysUIApplication::SysUIApplication() {} | 254 SysUIApplication::SysUIApplication() {} |
| 254 | 255 |
| 255 SysUIApplication::~SysUIApplication() {} | 256 SysUIApplication::~SysUIApplication() {} |
| 256 | 257 |
| 257 void SysUIApplication::Initialize(mojo::Shell* shell, | 258 void SysUIApplication::Initialize(mojo::Connector* connector, |
| 258 const std::string& url, | 259 const std::string& url, |
| 259 uint32_t id, | 260 uint32_t id, |
| 260 uint32_t user_id) { | 261 uint32_t user_id) { |
| 261 ash_init_.reset(new AshInit()); | 262 ash_init_.reset(new AshInit()); |
| 262 ash_init_->Initialize(shell); | 263 ash_init_->Initialize(connector); |
| 263 } | 264 } |
| 264 | 265 |
| 265 bool SysUIApplication::AcceptConnection(mojo::Connection* connection) { | 266 bool SysUIApplication::AcceptConnection(mojo::Connection* connection) { |
| 266 return true; | 267 return true; |
| 267 } | 268 } |
| 268 | 269 |
| 269 } // namespace sysui | 270 } // namespace sysui |
| 270 } // namespace ash | 271 } // namespace ash |
| OLD | NEW |