| 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 #ifndef MOJO_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ | 5 #ifndef MOJO_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ |
| 6 #define MOJO_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ | 6 #define MOJO_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ |
| 7 | 7 |
| 8 #include "base/native_library.h" | 8 #include "base/native_library.h" |
| 9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
| 10 #include "mojo/shell/public/interfaces/application.mojom.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 class FilePath; | 13 class FilePath; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace mojo { | 16 namespace mojo { |
| 16 class Application; | 17 class Application; |
| 17 namespace shell { | 18 namespace shell { |
| 18 | 19 |
| 19 // Loads the native Mojo application from the DSO specified by |app_path|. | 20 // Loads the native Mojo application from the DSO specified by |app_path|. |
| 20 // Returns the |base::NativeLibrary| for the application on success (or null on | 21 // Returns the |base::NativeLibrary| for the application on success (or null on |
| 21 // failure). | 22 // failure). |
| 22 // | 23 // |
| 23 // Note: The caller may choose to eventually unload the returned DSO. If so, | 24 // Note: The caller may choose to eventually unload the returned DSO. If so, |
| 24 // this should be done only after the thread on which |LoadNativeApplication()| | 25 // this should be done only after the thread on which |LoadNativeApplication()| |
| 25 // and |RunNativeApplication()| were called has terminated, so that any | 26 // and |RunNativeApplication()| were called has terminated, so that any |
| 26 // thread-local destructors have been executed. | 27 // thread-local destructors have been executed. |
| 27 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path); | 28 base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path); |
| 28 | 29 |
| 29 // Runs the native Mojo application from the DSO that was loaded using | 30 // Runs the native Mojo application from the DSO that was loaded using |
| 30 // |LoadNativeApplication()|; this tolerates |app_library| being null. This | 31 // |LoadNativeApplication()|; this tolerates |app_library| being null. This |
| 31 // should be called on the same thread as |LoadNativeApplication()|. Returns | 32 // should be called on the same thread as |LoadNativeApplication()|. Returns |
| 32 // true if |MojoMain()| was called (even if it returns an error), and false | 33 // true if |MojoMain()| was called (even if it returns an error), and false |
| 33 // otherwise. | 34 // otherwise. |
| 34 // TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter? | 35 // TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter? |
| 35 bool RunNativeApplication(base::NativeLibrary app_library, | 36 bool RunNativeApplication( |
| 36 InterfaceRequest<Application> application_request); | 37 base::NativeLibrary app_library, |
| 38 InterfaceRequest<mojom::Application> application_request); |
| 37 | 39 |
| 38 } // namespace shell | 40 } // namespace shell |
| 39 } // namespace mojo | 41 } // namespace mojo |
| 40 | 42 |
| 41 #endif // MOJO_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ | 43 #endif // MOJO_SHELL_RUNNER_HOST_NATIVE_APPLICATION_SUPPORT_H_ |
| OLD | NEW |