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

Side by Side Diff: mash/quick_launch/quick_launch.cc

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: still need to check MessageLoop::current() in Mojo's RunLoopNestingObserver::GetForThread() Created 3 years, 7 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 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/quick_launch/quick_launch.h" 5 #include "mash/quick_launch/quick_launch.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "mash/public/interfaces/launchable.mojom.h" 14 #include "mash/public/interfaces/launchable.mojom.h"
14 #include "services/catalog/public/interfaces/catalog.mojom.h" 15 #include "services/catalog/public/interfaces/catalog.mojom.h"
15 #include "services/catalog/public/interfaces/constants.mojom.h" 16 #include "services/catalog/public/interfaces/constants.mojom.h"
16 #include "services/service_manager/public/c/main.h" 17 #include "services/service_manager/public/c/main.h"
17 #include "services/service_manager/public/cpp/connector.h" 18 #include "services/service_manager/public/cpp/connector.h"
18 #include "services/service_manager/public/cpp/service.h" 19 #include "services/service_manager/public/cpp/service.h"
19 #include "services/service_manager/public/cpp/service_context.h" 20 #include "services/service_manager/public/cpp/service_context.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 QuickLaunch::~QuickLaunch() { 160 QuickLaunch::~QuickLaunch() {
160 while (!windows_.empty()) 161 while (!windows_.empty())
161 windows_.front()->CloseNow(); 162 windows_.front()->CloseNow();
162 } 163 }
163 164
164 void QuickLaunch::RemoveWindow(views::Widget* window) { 165 void QuickLaunch::RemoveWindow(views::Widget* window) {
165 auto it = std::find(windows_.begin(), windows_.end(), window); 166 auto it = std::find(windows_.begin(), windows_.end(), window);
166 DCHECK(it != windows_.end()); 167 DCHECK(it != windows_.end());
167 windows_.erase(it); 168 windows_.erase(it);
168 if (windows_.empty() && base::MessageLoop::current()->is_running()) 169 if (windows_.empty() && base::RunLoop::IsRunningOnCurrentThread())
169 base::MessageLoop::current()->QuitWhenIdle(); 170 base::MessageLoop::current()->QuitWhenIdle();
170 } 171 }
171 172
172 void QuickLaunch::OnStart() { 173 void QuickLaunch::OnStart() {
173 aura_init_ = base::MakeUnique<views::AuraInit>( 174 aura_init_ = base::MakeUnique<views::AuraInit>(
174 context()->connector(), context()->identity(), "views_mus_resources.pak", 175 context()->connector(), context()->identity(), "views_mus_resources.pak",
175 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); 176 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS);
176 177
177 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); 178 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW);
178 } 179 }
(...skipping 24 matching lines...) Expand all
203 windows_.push_back(window); 204 windows_.push_back(window);
204 } 205 }
205 206
206 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, 207 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info,
207 ::mash::mojom::LaunchableRequest request) { 208 ::mash::mojom::LaunchableRequest request) {
208 bindings_.AddBinding(this, std::move(request)); 209 bindings_.AddBinding(this, std::move(request));
209 } 210 }
210 211
211 } // namespace quick_launch 212 } // namespace quick_launch
212 } // namespace mash 213 } // namespace mash
OLDNEW
« no previous file with comments | « extensions/browser/api/alarms/alarms_api_unittest.cc ('k') | mojo/public/cpp/bindings/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698