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

Side by Side Diff: examples/surfaces_app/surfaces_app.cc

Issue 943053003: Simple multi-url support for mojo apps (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: hate Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/surfaces/surface_id_allocator.h" 9 #include "cc/surfaces/surface_id_allocator.h"
10 #include "examples/surfaces_app/child.mojom.h" 10 #include "examples/surfaces_app/child.mojom.h"
(...skipping 18 matching lines...) Expand all
29 static const uint32_t kLocalId = 1u; 29 static const uint32_t kLocalId = 1u;
30 30
31 class SurfacesApp : public ApplicationDelegate { 31 class SurfacesApp : public ApplicationDelegate {
32 public: 32 public:
33 SurfacesApp() : app_impl_(nullptr), id_namespace_(0u), weak_factory_(this) {} 33 SurfacesApp() : app_impl_(nullptr), id_namespace_(0u), weak_factory_(this) {}
34 ~SurfacesApp() override {} 34 ~SurfacesApp() override {}
35 35
36 void Initialize(ApplicationImpl* app) override { app_impl_ = app; } 36 void Initialize(ApplicationImpl* app) override { app_impl_ = app; }
37 37
38 // ApplicationDelegate implementation 38 // ApplicationDelegate implementation
39 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { 39 bool ConfigureIncomingConnection(ApplicationConnection* connection,
40 const std::string& url) override {
40 app_impl_->ConnectToService("mojo:native_viewport_service", &viewport_); 41 app_impl_->ConnectToService("mojo:native_viewport_service", &viewport_);
41 42
42 app_impl_->ConnectToService("mojo:surfaces_service", &surface_); 43 app_impl_->ConnectToService("mojo:surfaces_service", &surface_);
43 surface_->GetIdNamespace( 44 surface_->GetIdNamespace(
44 base::Bind(&SurfacesApp::SetIdNamespace, base::Unretained(this))); 45 base::Bind(&SurfacesApp::SetIdNamespace, base::Unretained(this)));
45 embedder_.reset(new Embedder(kLocalId, surface_.get())); 46 embedder_.reset(new Embedder(kLocalId, surface_.get()));
46 47
47 size_ = gfx::Size(800, 600); 48 size_ = gfx::Size(800, 600);
48 49
49 viewport_->Create(Size::From(size_), 50 viewport_->Create(Size::From(size_),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 DISALLOW_COPY_AND_ASSIGN(SurfacesApp); 118 DISALLOW_COPY_AND_ASSIGN(SurfacesApp);
118 }; 119 };
119 120
120 } // namespace examples 121 } // namespace examples
121 } // namespace mojo 122 } // namespace mojo
122 123
123 MojoResult MojoMain(MojoHandle shell_handle) { 124 MojoResult MojoMain(MojoHandle shell_handle) {
124 mojo::ApplicationRunnerChromium runner(new mojo::examples::SurfacesApp); 125 mojo::ApplicationRunnerChromium runner(new mojo::examples::SurfacesApp);
125 return runner.Run(shell_handle); 126 return runner.Run(shell_handle);
126 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698