OLD | NEW |
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 "chrome/browser/chrome_browser_main_extra_parts_exo.h" | 5 #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 | 8 |
9 #if defined(USE_GLIB) | 9 #if defined(USE_GLIB) |
10 #include <glib.h> | 10 #include <glib.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "chrome/browser/ui/ash/ash_util.h" | 16 #include "chrome/browser/ui/ash/ash_util.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "components/exo/display.h" | 18 #include "components/exo/display.h" |
19 #include "components/exo/wayland/server.h" | 19 #include "components/exo/wayland/server.h" |
20 #include "components/exo/wm_helper_ash.h" | 20 #include "components/exo/wm_helper_ash.h" |
21 #include "components/exo/wm_helper_mus.h" | 21 #include "components/exo/wm_helper_mus.h" |
22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
23 #include "ui/arc/notification/arc_notification_surface_manager.h" | 23 #include "ui/arc/notification/arc_notification_surface_manager_impl.h" |
24 | 24 |
25 #if defined(USE_GLIB) | 25 #if defined(USE_GLIB) |
26 namespace { | 26 namespace { |
27 | 27 |
28 struct GLibWaylandSource : public GSource { | 28 struct GLibWaylandSource : public GSource { |
29 // Note: The GLibWaylandSource is created and destroyed by GLib. So its | 29 // Note: The GLibWaylandSource is created and destroyed by GLib. So its |
30 // constructor/destructor may or may not get called. | 30 // constructor/destructor may or may not get called. |
31 exo::wayland::Server* server; | 31 exo::wayland::Server* server; |
32 GPollFD* poll_fd; | 32 GPollFD* poll_fd; |
33 }; | 33 }; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 ChromeBrowserMainExtraPartsExo::ChromeBrowserMainExtraPartsExo() {} | 116 ChromeBrowserMainExtraPartsExo::ChromeBrowserMainExtraPartsExo() {} |
117 | 117 |
118 ChromeBrowserMainExtraPartsExo::~ChromeBrowserMainExtraPartsExo() {} | 118 ChromeBrowserMainExtraPartsExo::~ChromeBrowserMainExtraPartsExo() {} |
119 | 119 |
120 void ChromeBrowserMainExtraPartsExo::PreProfileInit() { | 120 void ChromeBrowserMainExtraPartsExo::PreProfileInit() { |
121 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 121 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
122 switches::kEnableWaylandServer)) | 122 switches::kEnableWaylandServer)) |
123 return; | 123 return; |
124 | 124 |
125 arc_notification_surface_manager_ = | 125 arc_notification_surface_manager_ = |
126 base::MakeUnique<arc::ArcNotificationSurfaceManager>(); | 126 base::MakeUnique<arc::ArcNotificationSurfaceManagerImpl>(); |
127 if (ash_util::IsRunningInMash()) | 127 if (ash_util::IsRunningInMash()) |
128 wm_helper_ = base::MakeUnique<exo::WMHelperMus>(); | 128 wm_helper_ = base::MakeUnique<exo::WMHelperMus>(); |
129 else | 129 else |
130 wm_helper_ = base::MakeUnique<exo::WMHelperAsh>(); | 130 wm_helper_ = base::MakeUnique<exo::WMHelperAsh>(); |
131 exo::WMHelper::SetInstance(wm_helper_.get()); | 131 exo::WMHelper::SetInstance(wm_helper_.get()); |
132 display_ = | 132 display_ = |
133 base::MakeUnique<exo::Display>(arc_notification_surface_manager_.get()); | 133 base::MakeUnique<exo::Display>(arc_notification_surface_manager_.get()); |
134 wayland_server_ = exo::wayland::Server::Create(display_.get()); | 134 wayland_server_ = exo::wayland::Server::Create(display_.get()); |
135 // Wayland server creation can fail if XDG_RUNTIME_DIR is not set correctly. | 135 // Wayland server creation can fail if XDG_RUNTIME_DIR is not set correctly. |
136 if (wayland_server_) | 136 if (wayland_server_) |
137 wayland_watcher_ = base::MakeUnique<WaylandWatcher>(wayland_server_.get()); | 137 wayland_watcher_ = base::MakeUnique<WaylandWatcher>(wayland_server_.get()); |
138 } | 138 } |
139 | 139 |
140 void ChromeBrowserMainExtraPartsExo::PostMainMessageLoopRun() { | 140 void ChromeBrowserMainExtraPartsExo::PostMainMessageLoopRun() { |
141 wayland_watcher_.reset(); | 141 wayland_watcher_.reset(); |
142 wayland_server_.reset(); | 142 wayland_server_.reset(); |
143 if (wm_helper_) { | 143 if (wm_helper_) { |
144 exo::WMHelper::SetInstance(nullptr); | 144 exo::WMHelper::SetInstance(nullptr); |
145 wm_helper_.reset(); | 145 wm_helper_.reset(); |
146 } | 146 } |
147 } | 147 } |
OLD | NEW |