Index: mojo/public/cpp/application/application_runner.h |
diff --git a/mojo/public/cpp/application/application_runner.h b/mojo/public/cpp/application/application_runner.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..931c1ca9025dedb7f1098185ca43844de4be6ec8 |
--- /dev/null |
+++ b/mojo/public/cpp/application/application_runner.h |
@@ -0,0 +1,45 @@ |
+// 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 MOJO_PUBLIC_APPLICATION_APPLICATION_RUNNER_H_ |
+#define MOJO_PUBLIC_APPLICATION_APPLICATION_RUNNER_H_ |
+ |
+#include "mojo/public/cpp/system/core.h" |
+ |
+namespace mojo { |
+ |
+class ApplicationDelegate; |
+ |
+// A utility for running an Application. The typical use case is to use |
+// when writing your MojoMain: |
+// |
+// extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( |
+// MojoHandle shell_handle) { |
+// return mojo::ApplicationRunner(new MyApplicationDelegate()) |
+// .Run(shell_handle); |
+// } |
+// |
+// ApplicationRunner takes care of mojo environment initialization and |
+// shutdown, and starting a RunLoop from which your application can run and |
+// ultimately Quit(). |
+class ApplicationRunner { |
+ public: |
+ // Takes ownership of |delegate|. |
+ explicit ApplicationRunner(ApplicationDelegate* delegate); |
+ ~ApplicationRunner(); |
+ |
+ // Once the various parameters have been set above, use Run to initialize an |
+ // ApplicationImpl wired to the provided delegate, and run a RunLoop until |
+ // the application exits. |
+ MojoResult Run(MojoHandle shell_handle); |
DaveMoore
2014/08/08 22:27:16
If there's only one Run() method it should take a
|
+ |
+ private: |
+ ApplicationDelegate* delegate_; |
+ |
+ MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationRunner); |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // MOJO_PUBLIC_APPLICATION_APPLICATION_RUNNER_H_ |