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

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

Issue 218763002: Change AckEvent into request / response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix early return Created 6 years, 8 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 | Annotate | Revision Log
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Overridden from NativeViewportClient: 76 // Overridden from NativeViewportClient:
77 virtual void OnCreated() OVERRIDE { 77 virtual void OnCreated() OVERRIDE {
78 } 78 }
79 virtual void OnDestroyed() OVERRIDE { 79 virtual void OnDestroyed() OVERRIDE {
80 base::MessageLoop::current()->Quit(); 80 base::MessageLoop::current()->Quit();
81 } 81 }
82 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE { 82 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE {
83 // TODO(beng): 83 // TODO(beng):
84 } 84 }
85 virtual void OnEvent(const Event& event) OVERRIDE { 85 virtual void OnEvent(const Event& event,
86 if (!event.location().is_null()) 86 const mojo::Callback<void()>& callback) OVERRIDE {
87 native_viewport_->AckEvent(event);
88 if (event.action() == ui::ET_KEY_RELEASED) { 87 if (event.action() == ui::ET_KEY_RELEASED) {
89 if (event.key_data().key_code() == ui::VKEY_L && 88 if (event.key_data().key_code() == ui::VKEY_L &&
90 (event.flags() & ui::EF_CONTROL_DOWN)) { 89 (event.flags() & ui::EF_CONTROL_DOWN)) {
91 InitLauncher(); 90 InitLauncher();
92 launcher_->Show(); 91 launcher_->Show();
93 } 92 }
94 } 93 }
94 callback.Run();
95 } 95 }
96 96
97 // Overridden from LauncherClient: 97 // Overridden from LauncherClient:
98 virtual void OnURLEntered(const mojo::String& url) OVERRIDE { 98 virtual void OnURLEntered(const mojo::String& url) OVERRIDE {
99 std::string url_spec = url.To<std::string>(); 99 std::string url_spec = url.To<std::string>();
100 printf("Received URL from launcher app: %s\n", url_spec.c_str()); 100 printf("Received URL from launcher app: %s\n", url_spec.c_str());
101 launcher_->Hide(); 101 launcher_->Hide();
102 } 102 }
103 103
104 void InitNativeViewport() { 104 void InitNativeViewport() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 extern "C" VIEW_MANAGER_EXPORT MojoResult CDECL MojoMain( 141 extern "C" VIEW_MANAGER_EXPORT MojoResult CDECL MojoMain(
142 MojoHandle shell_handle) { 142 MojoHandle shell_handle) {
143 base::MessageLoop loop; 143 base::MessageLoop loop;
144 mojo::Application app(shell_handle); 144 mojo::Application app(shell_handle);
145 app.AddServiceFactory( 145 app.AddServiceFactory(
146 new mojo::ServiceFactory<mojo::examples::ViewManagerImpl>); 146 new mojo::ServiceFactory<mojo::examples::ViewManagerImpl>);
147 loop.Run(); 147 loop.Run();
148 148
149 return MOJO_RESULT_OK; 149 return MOJO_RESULT_OK;
150 } 150 }
OLDNEW
« no previous file with comments | « mojo/examples/sample_app/sample_app.cc ('k') | mojo/services/native_viewport/native_viewport.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698