Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: ash/mus/window_manager_application.cc

Issue 2116153002: Initialize DBus in mojo:ash on chrome os (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, move init later Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/window_manager_application.h" 5 #include "ash/mus/window_manager_application.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/mus/accelerator_registrar_impl.h" 9 #include "ash/mus/accelerator_registrar_impl.h"
10 #include "ash/mus/root_window_controller.h" 10 #include "ash/mus/root_window_controller.h"
11 #include "ash/mus/shelf_layout_impl.h" 11 #include "ash/mus/shelf_layout_impl.h"
12 #include "ash/mus/user_window_controller_impl.h" 12 #include "ash/mus/user_window_controller_impl.h"
13 #include "ash/mus/window_manager.h" 13 #include "ash/mus/window_manager.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "services/shell/public/cpp/connection.h" 16 #include "services/shell/public/cpp/connection.h"
17 #include "services/shell/public/cpp/connector.h" 17 #include "services/shell/public/cpp/connector.h"
18 #include "services/tracing/public/cpp/tracing_impl.h" 18 #include "services/tracing/public/cpp/tracing_impl.h"
19 #include "services/ui/common/event_matcher_util.h" 19 #include "services/ui/common/event_matcher_util.h"
20 #include "services/ui/common/gpu_service.h" 20 #include "services/ui/common/gpu_service.h"
21 #include "services/ui/public/cpp/window.h" 21 #include "services/ui/public/cpp/window.h"
22 #include "services/ui/public/cpp/window_tree_client.h" 22 #include "services/ui/public/cpp/window_tree_client.h"
23 #include "ui/events/event.h" 23 #include "ui/events/event.h"
24 #include "ui/views/mus/aura_init.h" 24 #include "ui/views/mus/aura_init.h"
25 25
26 #if defined(OS_CHROMEOS)
27 #include "chromeos/dbus/dbus_thread_manager.h"
28 #endif
29
26 namespace ash { 30 namespace ash {
27 namespace mus { 31 namespace mus {
28 32
29 WindowManagerApplication::WindowManagerApplication() 33 WindowManagerApplication::WindowManagerApplication()
30 : connector_(nullptr), screenlock_state_listener_binding_(this) {} 34 : connector_(nullptr), screenlock_state_listener_binding_(this) {}
31 35
32 WindowManagerApplication::~WindowManagerApplication() { 36 WindowManagerApplication::~WindowManagerApplication() {
33 // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy 37 // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy
34 // it early on. 38 // it early on.
35 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( 39 std::set<AcceleratorRegistrarImpl*> accelerator_registrars(
36 accelerator_registrars_); 40 accelerator_registrars_);
37 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) 41 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars)
38 registrar->Destroy(); 42 registrar->Destroy();
39 43
40 // Destroy the WindowManager while still valid. This way we ensure 44 // Destroy the WindowManager while still valid. This way we ensure
41 // OnWillDestroyRootWindowController() is called (if it hasn't been already). 45 // OnWillDestroyRootWindowController() is called (if it hasn't been already).
42 window_manager_.reset(); 46 window_manager_.reset();
47
48 #if defined(OS_CHROMEOS)
49 chromeos::DBusThreadManager::Shutdown();
50 #endif
43 } 51 }
44 52
45 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( 53 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed(
46 AcceleratorRegistrarImpl* registrar) { 54 AcceleratorRegistrarImpl* registrar) {
47 accelerator_registrars_.erase(registrar); 55 accelerator_registrars_.erase(registrar);
48 } 56 }
49 57
50 void WindowManagerApplication::InitWindowManager( 58 void WindowManagerApplication::InitWindowManager(
51 ::ui::WindowTreeClient* window_tree_client) { 59 ::ui::WindowTreeClient* window_tree_client) {
60 #if defined(OS_CHROMEOS)
61 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but
62 // before WindowManager::Init().
63 chromeos::DBusThreadManager::Initialize();
64 #endif
52 window_manager_->Init(window_tree_client); 65 window_manager_->Init(window_tree_client);
53 window_manager_->AddObserver(this); 66 window_manager_->AddObserver(this);
54 } 67 }
55 68
56 void WindowManagerApplication::OnStart(shell::Connector* connector, 69 void WindowManagerApplication::OnStart(shell::Connector* connector,
57 const shell::Identity& identity, 70 const shell::Identity& identity,
58 uint32_t id) { 71 uint32_t id) {
59 connector_ = connector; 72 connector_ = connector;
60 ::ui::GpuService::Initialize(connector); 73 ::ui::GpuService::Initialize(connector);
61 window_manager_.reset(new WindowManager(connector_)); 74 window_manager_.reset(new WindowManager(connector_));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 RootWindowController* controller) { 173 RootWindowController* controller) {
161 // TODO(msw): this isn't right, ownership should belong in WindowManager 174 // TODO(msw): this isn't right, ownership should belong in WindowManager
162 // and/or RootWindowController. But this is temporary until we get rid of 175 // and/or RootWindowController. But this is temporary until we get rid of
163 // sysui. 176 // sysui.
164 shelf_layout_.reset(); 177 shelf_layout_.reset();
165 user_window_controller_.reset(); 178 user_window_controller_.reset();
166 } 179 }
167 180
168 } // namespace mus 181 } // namespace mus
169 } // namespace ash 182 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698