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

Side by Side Diff: chrome/browser/chrome_browser_main_extra_parts_exo.cc

Issue 2250863003: exo: Run exo in mus+ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review issues Created 4 years, 4 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
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 "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"
21 #include "components/exo/wm_helper_mus.h"
20 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
21 #include "ui/arc/notification/arc_notification_surface_manager.h" 23 #include "ui/arc/notification/arc_notification_surface_manager.h"
22 24
23 #if defined(USE_GLIB) 25 #if defined(USE_GLIB)
24 namespace { 26 namespace {
25 27
26 struct GLibWaylandSource : public GSource { 28 struct GLibWaylandSource : public GSource {
27 // Note: The GLibWaylandSource is created and destroyed by GLib. So its 29 // Note: The GLibWaylandSource is created and destroyed by GLib. So its
28 // constructor/destructor may or may not get called. 30 // constructor/destructor may or may not get called.
29 exo::wayland::Server* server; 31 exo::wayland::Server* server;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); } 105 void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); }
104 106
105 private: 107 private:
106 base::MessagePumpLibevent::FileDescriptorWatcher controller_; 108 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
107 exo::wayland::Server* const server_; 109 exo::wayland::Server* const server_;
108 110
109 DISALLOW_COPY_AND_ASSIGN(WaylandWatcher); 111 DISALLOW_COPY_AND_ASSIGN(WaylandWatcher);
110 }; 112 };
111 #endif 113 #endif
112 114
113 ChromeBrowserMainExtraPartsExo::ChromeBrowserMainExtraPartsExo() 115 ChromeBrowserMainExtraPartsExo::ChromeBrowserMainExtraPartsExo() {}
114 : arc_notification_surface_manager_(new arc::ArcNotificationSurfaceManager),
115 display_(new exo::Display(arc_notification_surface_manager_.get())) {}
116 116
117 ChromeBrowserMainExtraPartsExo::~ChromeBrowserMainExtraPartsExo() {} 117 ChromeBrowserMainExtraPartsExo::~ChromeBrowserMainExtraPartsExo() {}
118 118
119 void ChromeBrowserMainExtraPartsExo::PreProfileInit() { 119 void ChromeBrowserMainExtraPartsExo::PreProfileInit() {
120 if (!chrome::ShouldOpenAshOnStartup()) 120 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
121 switches::kEnableWaylandServer))
121 return; 122 return;
122 123
123 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 124 arc_notification_surface_manager_ =
124 switches::kEnableWaylandServer)) { 125 base::MakeUnique<arc::ArcNotificationSurfaceManager>();
125 wayland_server_ = exo::wayland::Server::Create(display_.get()); 126 const bool using_mus = !chrome::ShouldOpenAshOnStartup();
126 wayland_watcher_ = 127 if (using_mus)
127 base::WrapUnique(new WaylandWatcher(wayland_server_.get())); 128 wm_helper_ = base::MakeUnique<exo::WMHelperMus>();
128 } 129 else
130 wm_helper_ = base::MakeUnique<exo::WMHelperAsh>();
131 exo::WMHelper::SetInstance(wm_helper_.get());
132 display_ = base::MakeUnique<exo::Display>(
133 arc_notification_surface_manager_.get());
134 wayland_server_ = exo::wayland::Server::Create(display_.get());
135 wayland_watcher_ = base::MakeUnique<WaylandWatcher>(wayland_server_.get());
129 } 136 }
130 137
131 void ChromeBrowserMainExtraPartsExo::PostMainMessageLoopRun() { 138 void ChromeBrowserMainExtraPartsExo::PostMainMessageLoopRun() {
132 wayland_watcher_.reset(); 139 wayland_watcher_.reset();
133 wayland_server_.reset(); 140 wayland_server_.reset();
141 exo::WMHelper::SetInstance(nullptr);
142 wm_helper_.reset();
134 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698