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

Side by Side Diff: examples/ui/tile/tile_app.cc

Issue 1425543002: mozart: Add a simple tiling view manager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <vector>
6
7 #include "base/strings/string_split.h"
8 #include "examples/ui/tile/tile_app.h"
9 #include "examples/ui/tile/tile_view.h"
10 #include "url/gurl.h"
11
12 namespace examples {
13
14 class TileViewProvider : public mojo::ui::ViewProvider {
15 public:
16 TileViewProvider(mojo::ApplicationImpl* app_impl,
17 const std::vector<std::string>& view_urls)
18 : app_impl_(app_impl), view_urls_(view_urls) {}
19 ~TileViewProvider() override {}
20
21 // |ViewProvider|:
22 void CreateView(mojo::InterfaceRequest<mojo::ServiceProvider> services,
23 mojo::ServiceProviderPtr exposed_services,
24 const CreateViewCallback& callback) override {
25 new TileView(app_impl_, view_urls_, callback);
26 }
27
28 private:
29 mojo::ApplicationImpl* app_impl_;
30 std::vector<std::string> view_urls_;
31 };
32
33 TileApp::TileApp() {}
34
35 TileApp::~TileApp() {}
36
37 void TileApp::Initialize(mojo::ApplicationImpl* app_impl) {
38 app_impl_ = app_impl;
39 }
40
41 bool TileApp::ConfigureIncomingConnection(
42 mojo::ApplicationConnection* connection) {
43 connection->AddService<mojo::ui::ViewProvider>(this);
44 return true;
45 }
46
47 void TileApp::Create(mojo::ApplicationConnection* connection,
48 mojo::InterfaceRequest<mojo::ui::ViewProvider> request) {
49 GURL url(connection->GetConnectionURL());
50 std::vector<std::string> view_urls;
51 base::SplitString(url.query(), ',', &view_urls);
abarth 2015/10/24 06:51:12 This is kind of lame. You should probably use the
jeffbrown 2015/10/27 03:13:08 Args won't work here. Suppose I wanted to embed t
52
53 if (view_urls.empty()) {
54 LOG(ERROR) << "Must supply comma-delimited URLs of mojo views to tile as a "
55 "query parameter.";
56 return;
57 }
58
59 bindings_.AddBinding(new TileViewProvider(app_impl_, view_urls),
60 request.Pass());
61 }
62
63 } // namespace examples
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698