| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |