| OLD | NEW |
| 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 "base/strings/string_split.h" | 5 #include "base/strings/string_split.h" |
| 6 #include "examples/ui/tile/tile_app.h" | 6 #include "examples/ui/tile/tile_app.h" |
| 7 #include "examples/ui/tile/tile_view.h" | 7 #include "examples/ui/tile/tile_view.h" |
| 8 #include "mojo/public/cpp/application/connect.h" | 8 #include "mojo/public/cpp/application/connect.h" |
| 9 #include "url/url_parse.h" | 9 #include "url/url_parse.h" |
| 10 | 10 |
| 11 namespace examples { | 11 namespace examples { |
| 12 | 12 |
| 13 TileApp::TileApp() {} | 13 TileApp::TileApp() {} |
| 14 | 14 |
| 15 TileApp::~TileApp() {} | 15 TileApp::~TileApp() {} |
| 16 | 16 |
| 17 void TileApp::CreateView( | 17 void TileApp::CreateView( |
| 18 const std::string& connection_url, | 18 const std::string& connection_url, |
| 19 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, | 19 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
| 20 mojo::InterfaceRequest<mojo::ServiceProvider> services) { | 20 mojo::InterfaceRequest<mojo::ServiceProvider> services) { |
| 21 TileParams params; | 21 TileParams params; |
| 22 if (!ParseParams(connection_url, ¶ms)) { | 22 if (!ParseParams(connection_url, ¶ms)) { |
| 23 LOG(ERROR) << "Missing or invalid URL parameters. See README."; | 23 LOG(ERROR) << "Missing or invalid URL parameters. See README."; |
| 24 return; | 24 return; |
| 25 } | 25 } |
| 26 | 26 |
| 27 new TileView(mojo::CreateApplicationConnector(app_impl()->shell()), | 27 new TileView(mojo::CreateApplicationConnector(shell()), |
| 28 view_owner_request.Pass(), params); | 28 view_owner_request.Pass(), params); |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool TileApp::ParseParams(const std::string& connection_url, | 31 bool TileApp::ParseParams(const std::string& connection_url, |
| 32 TileParams* params) { | 32 TileParams* params) { |
| 33 url::Parsed parsed; | 33 url::Parsed parsed; |
| 34 url::ParseStandardURL(connection_url.c_str(), connection_url.size(), &parsed); | 34 url::ParseStandardURL(connection_url.c_str(), connection_url.size(), &parsed); |
| 35 url::Component query = parsed.query; | 35 url::Component query = parsed.query; |
| 36 | 36 |
| 37 for (;;) { | 37 for (;;) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return false; | 70 return false; |
| 71 } else { | 71 } else { |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 return !params->view_urls.empty(); | 76 return !params->view_urls.empty(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace examples | 79 } // namespace examples |
| OLD | NEW |