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

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

Issue 668483002: Change mojo URLs from mojo://mojo_foo to mojo://foo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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 "mojo/application/application_runner_chromium.h" 10 #include "mojo/application/application_runner_chromium.h"
(...skipping 18 matching lines...) Expand all
29 class SurfacesApp : public ApplicationDelegate, 29 class SurfacesApp : public ApplicationDelegate,
30 public SurfaceClient, 30 public SurfaceClient,
31 public NativeViewportClient { 31 public NativeViewportClient {
32 public: 32 public:
33 SurfacesApp() : weak_factory_(this) {} 33 SurfacesApp() : weak_factory_(this) {}
34 virtual ~SurfacesApp() {} 34 virtual ~SurfacesApp() {}
35 35
36 // ApplicationDelegate implementation 36 // ApplicationDelegate implementation
37 virtual bool ConfigureIncomingConnection( 37 virtual bool ConfigureIncomingConnection(
38 ApplicationConnection* connection) override { 38 ApplicationConnection* connection) override {
39 connection->ConnectToService("mojo:mojo_native_viewport_service", 39 connection->ConnectToService("mojo:native_viewport_service", &viewport_);
40 &viewport_);
41 viewport_.set_client(this); 40 viewport_.set_client(this);
42 41
43 connection->ConnectToService("mojo:mojo_surfaces_service", 42 connection->ConnectToService("mojo:surfaces_service", &surfaces_service_);
44 &surfaces_service_);
45 surfaces_service_->CreateSurfaceConnection(base::Bind( 43 surfaces_service_->CreateSurfaceConnection(base::Bind(
46 &SurfacesApp::SurfaceConnectionCreated, base::Unretained(this))); 44 &SurfacesApp::SurfaceConnectionCreated, base::Unretained(this)));
47 45
48 size_ = gfx::Size(800, 600); 46 size_ = gfx::Size(800, 600);
49 47
50 viewport_->Create(Size::From(size_), 48 viewport_->Create(Size::From(size_),
51 base::Bind(&SurfacesApp::OnCreatedNativeViewport, 49 base::Bind(&SurfacesApp::OnCreatedNativeViewport,
52 weak_factory_.GetWeakPtr())); 50 weak_factory_.GetWeakPtr()));
53 viewport_->Show(); 51 viewport_->Show();
54 52
55 child_size_ = gfx::Size(size_.width() / 3, size_.height() / 2); 53 child_size_ = gfx::Size(size_.width() / 3, size_.height() / 2);
56 connection->ConnectToService("mojo:mojo_surfaces_child_app", &child_one_); 54 connection->ConnectToService("mojo:surfaces_child_app", &child_one_);
57 connection->ConnectToService("mojo:mojo_surfaces_child_gl_app", 55 connection->ConnectToService("mojo:surfaces_child_gl_app", &child_two_);
58 &child_two_);
59 child_one_->ProduceFrame(Color::From(SK_ColorBLUE), 56 child_one_->ProduceFrame(Color::From(SK_ColorBLUE),
60 Size::From(child_size_), 57 Size::From(child_size_),
61 base::Bind(&SurfacesApp::ChildOneProducedFrame, 58 base::Bind(&SurfacesApp::ChildOneProducedFrame,
62 base::Unretained(this))); 59 base::Unretained(this)));
63 child_two_->ProduceFrame(Color::From(SK_ColorGREEN), 60 child_two_->ProduceFrame(Color::From(SK_ColorGREEN),
64 Size::From(child_size_), 61 Size::From(child_size_),
65 base::Bind(&SurfacesApp::ChildTwoProducedFrame, 62 base::Bind(&SurfacesApp::ChildTwoProducedFrame,
66 base::Unretained(this))); 63 base::Unretained(this)));
67 return true; 64 return true;
68 } 65 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 DISALLOW_COPY_AND_ASSIGN(SurfacesApp); 132 DISALLOW_COPY_AND_ASSIGN(SurfacesApp);
136 }; 133 };
137 134
138 } // namespace examples 135 } // namespace examples
139 } // namespace mojo 136 } // namespace mojo
140 137
141 MojoResult MojoMain(MojoHandle shell_handle) { 138 MojoResult MojoMain(MojoHandle shell_handle) {
142 mojo::ApplicationRunnerChromium runner(new mojo::examples::SurfacesApp); 139 mojo::ApplicationRunnerChromium runner(new mojo::examples::SurfacesApp);
143 return runner.Run(shell_handle); 140 return runner.Run(shell_handle);
144 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698