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

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

Issue 2487573002: Service Manager: Remove ServiceContext* arg from Service::OnStart() (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | « mash/quick_launch/quick_launch.h ('k') | mash/screenlock/screenlock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 QuickLaunch::~QuickLaunch() {} 159 QuickLaunch::~QuickLaunch() {}
160 160
161 void QuickLaunch::RemoveWindow(views::Widget* window) { 161 void QuickLaunch::RemoveWindow(views::Widget* window) {
162 auto it = std::find(windows_.begin(), windows_.end(), window); 162 auto it = std::find(windows_.begin(), windows_.end(), window);
163 DCHECK(it != windows_.end()); 163 DCHECK(it != windows_.end());
164 windows_.erase(it); 164 windows_.erase(it);
165 if (windows_.empty() && base::MessageLoop::current()->is_running()) 165 if (windows_.empty() && base::MessageLoop::current()->is_running())
166 base::MessageLoop::current()->QuitWhenIdle(); 166 base::MessageLoop::current()->QuitWhenIdle();
167 } 167 }
168 168
169 void QuickLaunch::OnStart(service_manager::ServiceContext* context) { 169 void QuickLaunch::OnStart() {
170 context_ = context; 170 tracing_.Initialize(context()->connector(), context()->identity().name());
171 tracing_.Initialize(context->connector(), context->identity().name());
172 171
173 aura_init_ = base::MakeUnique<views::AuraInit>( 172 aura_init_ = base::MakeUnique<views::AuraInit>(
174 context->connector(), context->identity(), "views_mus_resources.pak"); 173 context()->connector(), context()->identity(), "views_mus_resources.pak");
175 window_manager_connection_ = views::WindowManagerConnection::Create( 174 window_manager_connection_ = views::WindowManagerConnection::Create(
176 context->connector(), context->identity()); 175 context()->connector(), context()->identity());
177 176
178 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); 177 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW);
179 } 178 }
180 179
181 bool QuickLaunch::OnConnect(const service_manager::ServiceInfo& remote_info, 180 bool QuickLaunch::OnConnect(const service_manager::ServiceInfo& remote_info,
182 service_manager::InterfaceRegistry* registry) { 181 service_manager::InterfaceRegistry* registry) {
183 registry->AddInterface<mojom::Launchable>(this); 182 registry->AddInterface<mojom::Launchable>(this);
184 return true; 183 return true;
185 } 184 }
186 185
187 void QuickLaunch::Launch(uint32_t what, mojom::LaunchMode how) { 186 void QuickLaunch::Launch(uint32_t what, mojom::LaunchMode how) {
188 bool reuse = how == mojom::LaunchMode::REUSE || 187 bool reuse = how == mojom::LaunchMode::REUSE ||
189 how == mojom::LaunchMode::DEFAULT; 188 how == mojom::LaunchMode::DEFAULT;
190 if (reuse && !windows_.empty()) { 189 if (reuse && !windows_.empty()) {
191 windows_.back()->Activate(); 190 windows_.back()->Activate();
192 return; 191 return;
193 } 192 }
194 catalog::mojom::CatalogPtr catalog; 193 catalog::mojom::CatalogPtr catalog;
195 context_->connector()->ConnectToInterface("service:catalog", &catalog); 194 context()->connector()->ConnectToInterface("service:catalog", &catalog);
196 195
197 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( 196 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
198 new QuickLaunchUI(this, context_->connector(), std::move(catalog)), 197 new QuickLaunchUI(this, context()->connector(), std::move(catalog)),
199 nullptr, gfx::Rect(10, 640, 0, 0)); 198 nullptr, gfx::Rect(10, 640, 0, 0));
200 window->Show(); 199 window->Show();
201 windows_.push_back(window); 200 windows_.push_back(window);
202 } 201 }
203 202
204 void QuickLaunch::Create(const service_manager::Identity& remote_identity, 203 void QuickLaunch::Create(const service_manager::Identity& remote_identity,
205 mojom::LaunchableRequest request) { 204 mojom::LaunchableRequest request) {
206 bindings_.AddBinding(this, std::move(request)); 205 bindings_.AddBinding(this, std::move(request));
207 } 206 }
208 207
209 } // namespace quick_launch 208 } // namespace quick_launch
210 } // namespace mash 209 } // namespace mash
OLDNEW
« no previous file with comments | « mash/quick_launch/quick_launch.h ('k') | mash/screenlock/screenlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698