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

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

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . 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
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/catalog_viewer/catalog_viewer.h" 5 #include "mash/catalog_viewer/catalog_viewer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 CatalogViewer::~CatalogViewer() {} 168 CatalogViewer::~CatalogViewer() {}
169 169
170 void CatalogViewer::RemoveWindow(views::Widget* window) { 170 void CatalogViewer::RemoveWindow(views::Widget* window) {
171 auto it = std::find(windows_.begin(), windows_.end(), window); 171 auto it = std::find(windows_.begin(), windows_.end(), window);
172 DCHECK(it != windows_.end()); 172 DCHECK(it != windows_.end());
173 windows_.erase(it); 173 windows_.erase(it);
174 if (windows_.empty()) 174 if (windows_.empty())
175 base::MessageLoop::current()->QuitWhenIdle(); 175 base::MessageLoop::current()->QuitWhenIdle();
176 } 176 }
177 177
178 void CatalogViewer::Initialize(shell::Connector* connector, 178 void CatalogViewer::OnStart(shell::Connector* connector,
179 const shell::Identity& identity, 179 const shell::Identity& identity,
180 uint32_t id) { 180 uint32_t id) {
181 connector_ = connector; 181 connector_ = connector;
182 tracing_.Initialize(connector, identity.name()); 182 tracing_.Initialize(connector, identity.name());
183 183
184 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); 184 aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak"));
185 window_manager_connection_ = 185 window_manager_connection_ =
186 views::WindowManagerConnection::Create(connector, identity); 186 views::WindowManagerConnection::Create(connector, identity);
187 } 187 }
188 188
189 bool CatalogViewer::AcceptConnection(shell::Connection* connection) { 189 bool CatalogViewer::OnConnect(shell::Connection* connection) {
190 connection->AddInterface<mojom::Launchable>(this); 190 connection->AddInterface<mojom::Launchable>(this);
191 return true; 191 return true;
192 } 192 }
193 193
194 void CatalogViewer::Launch(uint32_t what, mojom::LaunchMode how) { 194 void CatalogViewer::Launch(uint32_t what, mojom::LaunchMode how) {
195 bool reuse = how == mojom::LaunchMode::REUSE || 195 bool reuse = how == mojom::LaunchMode::REUSE ||
196 how == mojom::LaunchMode::DEFAULT; 196 how == mojom::LaunchMode::DEFAULT;
197 if (reuse && !windows_.empty()) { 197 if (reuse && !windows_.empty()) {
198 windows_.back()->Activate(); 198 windows_.back()->Activate();
199 return; 199 return;
200 } 200 }
201 catalog::mojom::CatalogPtr catalog; 201 catalog::mojom::CatalogPtr catalog;
202 connector_->ConnectToInterface("mojo:catalog", &catalog); 202 connector_->ConnectToInterface("mojo:catalog", &catalog);
203 203
204 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( 204 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
205 new CatalogViewerContents(this, std::move(catalog)), nullptr, 205 new CatalogViewerContents(this, std::move(catalog)), nullptr,
206 gfx::Rect(25, 25, 500, 600)); 206 gfx::Rect(25, 25, 500, 600));
207 window->Show(); 207 window->Show();
208 windows_.push_back(window); 208 windows_.push_back(window);
209 } 209 }
210 210
211 void CatalogViewer::Create(shell::Connection* connection, 211 void CatalogViewer::Create(shell::Connection* connection,
212 mojom::LaunchableRequest request) { 212 mojom::LaunchableRequest request) {
213 bindings_.AddBinding(this, std::move(request)); 213 bindings_.AddBinding(this, std::move(request));
214 } 214 }
215 215
216 } // namespace catalog_viewer 216 } // namespace catalog_viewer
217 } // namespace mash 217 } // namespace mash
OLDNEW
« no previous file with comments | « mash/catalog_viewer/catalog_viewer.h ('k') | mash/example/views_examples/views_examples_application_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698