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