Index: mojo/shell/native_application_support.h |
diff --git a/mojo/shell/native_application_support.h b/mojo/shell/native_application_support.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..572c089b426246b48e1b53deb280be2598827b32 |
--- /dev/null |
+++ b/mojo/shell/native_application_support.h |
@@ -0,0 +1,51 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SHELL_NATIVE_APPLICATION_SUPPORT_H_ |
+#define SHELL_NATIVE_APPLICATION_SUPPORT_H_ |
+ |
+#include "base/native_library.h" |
+#include "mojo/public/cpp/bindings/interface_request.h" |
+ |
+#if defined(OS_WIN) |
+#undef DELETE |
+#endif |
+ |
+namespace base { |
+class FilePath; |
+} |
+ |
+namespace mojo { |
+ |
+class Application; |
+ |
+namespace shell { |
+ |
+enum class NativeApplicationCleanup { DELETE, DONT_DELETE }; |
+ |
+// Loads the native Mojo application from the DSO specified by |app_path|. |
+// Returns the |base::NativeLibrary| for the application on success (or null on |
+// failure). If |cleanup| is |DELETE|, it will delete |app_path| (regardless of |
+// sucess or failure). |
+// |
+// Note: The caller may choose to eventually unload the returned DSO. If so, |
+// this should be done only after the thread on which |LoadNativeApplication()| |
+// and |RunNativeApplication()| were called has terminated, so that any |
+// thread-local destructors have been executed. |
+base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path, |
+ NativeApplicationCleanup cleanup); |
+ |
+// Runs the native Mojo application from the DSO that was loaded using |
+// |LoadNativeApplication()|; this tolerates |app_library| being null. This |
+// should be called on the same thread as |LoadNativeApplication()|. Returns |
+// true if |MojoMain()| was called (even if it returns an error), and false |
+// otherwise. |
+// TODO(vtl): Maybe this should also have a |MojoResult| as an out parameter? |
+bool RunNativeApplication(base::NativeLibrary app_library, |
+ InterfaceRequest<Application> application_request); |
+ |
+} // namespace shell |
+} // namespace mojo |
+ |
+#endif // SHELL_NATIVE_APPLICATION_SUPPORT_H_ |