OLD | NEW |
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 Loading... |
168 | 168 |
169 void CatalogViewer::OnStart(const shell::Identity& identity) { | 169 void CatalogViewer::OnStart(const shell::Identity& identity) { |
170 tracing_.Initialize(connector(), identity.name()); | 170 tracing_.Initialize(connector(), identity.name()); |
171 | 171 |
172 aura_init_.reset( | 172 aura_init_.reset( |
173 new views::AuraInit(connector(), "views_mus_resources.pak")); | 173 new views::AuraInit(connector(), "views_mus_resources.pak")); |
174 window_manager_connection_ = | 174 window_manager_connection_ = |
175 views::WindowManagerConnection::Create(connector(), identity); | 175 views::WindowManagerConnection::Create(connector(), identity); |
176 } | 176 } |
177 | 177 |
178 bool CatalogViewer::OnConnect(shell::Connection* connection) { | 178 bool CatalogViewer::OnConnect(const shell::Identity& remote_identity, |
179 connection->AddInterface<mojom::Launchable>(this); | 179 shell::InterfaceRegistry* registry) { |
| 180 registry->AddInterface<mojom::Launchable>(this); |
180 return true; | 181 return true; |
181 } | 182 } |
182 | 183 |
183 void CatalogViewer::Launch(uint32_t what, mojom::LaunchMode how) { | 184 void CatalogViewer::Launch(uint32_t what, mojom::LaunchMode how) { |
184 bool reuse = how == mojom::LaunchMode::REUSE || | 185 bool reuse = how == mojom::LaunchMode::REUSE || |
185 how == mojom::LaunchMode::DEFAULT; | 186 how == mojom::LaunchMode::DEFAULT; |
186 if (reuse && !windows_.empty()) { | 187 if (reuse && !windows_.empty()) { |
187 windows_.back()->Activate(); | 188 windows_.back()->Activate(); |
188 return; | 189 return; |
189 } | 190 } |
190 catalog::mojom::CatalogPtr catalog; | 191 catalog::mojom::CatalogPtr catalog; |
191 connector()->ConnectToInterface("mojo:catalog", &catalog); | 192 connector()->ConnectToInterface("mojo:catalog", &catalog); |
192 | 193 |
193 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 194 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
194 new CatalogViewerContents(this, std::move(catalog)), nullptr, | 195 new CatalogViewerContents(this, std::move(catalog)), nullptr, |
195 gfx::Rect(25, 25, 500, 600)); | 196 gfx::Rect(25, 25, 500, 600)); |
196 window->Show(); | 197 window->Show(); |
197 windows_.push_back(window); | 198 windows_.push_back(window); |
198 } | 199 } |
199 | 200 |
200 void CatalogViewer::Create(const shell::Identity& remote_identity, | 201 void CatalogViewer::Create(const shell::Identity& remote_identity, |
201 mojom::LaunchableRequest request) { | 202 mojom::LaunchableRequest request) { |
202 bindings_.AddBinding(this, std::move(request)); | 203 bindings_.AddBinding(this, std::move(request)); |
203 } | 204 } |
204 | 205 |
205 } // namespace catalog_viewer | 206 } // namespace catalog_viewer |
206 } // namespace mash | 207 } // namespace mash |
OLD | NEW |