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

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

Issue 617503003: Mojo: MOJO_OVERRIDE -> override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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
« no previous file with comments | « mojo/examples/png_viewer/png_viewer.cc ('k') | mojo/examples/wget/wget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 <stdio.h> 5 #include <stdio.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "mojo/examples/sample_app/gles2_client_impl.h" 10 #include "mojo/examples/sample_app/gles2_client_impl.h"
(...skipping 13 matching lines...) Expand all
24 class SampleApp : public mojo::ApplicationDelegate, 24 class SampleApp : public mojo::ApplicationDelegate,
25 public mojo::NativeViewportClient { 25 public mojo::NativeViewportClient {
26 public: 26 public:
27 SampleApp() : weak_factory_(this) {} 27 SampleApp() : weak_factory_(this) {}
28 28
29 virtual ~SampleApp() { 29 virtual ~SampleApp() {
30 // TODO(darin): Fix shutdown so we don't need to leak this. 30 // TODO(darin): Fix shutdown so we don't need to leak this.
31 MOJO_ALLOW_UNUSED GLES2ClientImpl* leaked = gles2_client_.release(); 31 MOJO_ALLOW_UNUSED GLES2ClientImpl* leaked = gles2_client_.release();
32 } 32 }
33 33
34 virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE { 34 virtual void Initialize(mojo::ApplicationImpl* app) override {
35 app->ConnectToService("mojo:mojo_native_viewport_service", &viewport_); 35 app->ConnectToService("mojo:mojo_native_viewport_service", &viewport_);
36 viewport_.set_client(this); 36 viewport_.set_client(this);
37 37
38 // TODO(jamesr): Should be mojo:mojo_gpu_service 38 // TODO(jamesr): Should be mojo:mojo_gpu_service
39 app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_); 39 app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_);
40 40
41 mojo::SizePtr size(mojo::Size::New()); 41 mojo::SizePtr size(mojo::Size::New());
42 size->width = 800; 42 size->width = 800;
43 size->height = 600; 43 size->height = 600;
44 viewport_->Create(size.Pass(), 44 viewport_->Create(size.Pass(),
45 base::Bind(&SampleApp::OnCreatedNativeViewport, 45 base::Bind(&SampleApp::OnCreatedNativeViewport,
46 weak_factory_.GetWeakPtr())); 46 weak_factory_.GetWeakPtr()));
47 viewport_->Show(); 47 viewport_->Show();
48 } 48 }
49 49
50 virtual void OnDestroyed() MOJO_OVERRIDE { mojo::RunLoop::current()->Quit(); } 50 virtual void OnDestroyed() override { mojo::RunLoop::current()->Quit(); }
51 51
52 virtual void OnSizeChanged(mojo::SizePtr size) MOJO_OVERRIDE { 52 virtual void OnSizeChanged(mojo::SizePtr size) override {
53 assert(size); 53 assert(size);
54 if (gles2_client_) 54 if (gles2_client_)
55 gles2_client_->SetSize(*size); 55 gles2_client_->SetSize(*size);
56 } 56 }
57 57
58 virtual void OnEvent(mojo::EventPtr event, 58 virtual void OnEvent(mojo::EventPtr event,
59 const mojo::Callback<void()>& callback) MOJO_OVERRIDE { 59 const mojo::Callback<void()>& callback) override {
60 assert(event); 60 assert(event);
61 if (event->location_data && event->location_data->in_view_location) 61 if (event->location_data && event->location_data->in_view_location)
62 gles2_client_->HandleInputEvent(*event); 62 gles2_client_->HandleInputEvent(*event);
63 callback.Run(); 63 callback.Run();
64 } 64 }
65 65
66 private: 66 private:
67 void OnCreatedNativeViewport(uint64_t native_viewport_id) { 67 void OnCreatedNativeViewport(uint64_t native_viewport_id) {
68 mojo::SizePtr size = mojo::Size::New(); 68 mojo::SizePtr size = mojo::Size::New();
69 size->width = 800; 69 size->width = 800;
(...skipping 12 matching lines...) Expand all
82 82
83 DISALLOW_COPY_AND_ASSIGN(SampleApp); 83 DISALLOW_COPY_AND_ASSIGN(SampleApp);
84 }; 84 };
85 85
86 } // namespace examples 86 } // namespace examples
87 87
88 MojoResult MojoMain(MojoHandle shell_handle) { 88 MojoResult MojoMain(MojoHandle shell_handle) {
89 mojo::ApplicationRunner runner(new examples::SampleApp); 89 mojo::ApplicationRunner runner(new examples::SampleApp);
90 return runner.Run(shell_handle); 90 return runner.Run(shell_handle);
91 } 91 }
OLDNEW
« no previous file with comments | « mojo/examples/png_viewer/png_viewer.cc ('k') | mojo/examples/wget/wget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698