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_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_ | 5 #ifndef MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_ |
6 #define MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_ | 6 #define MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "third_party/mojo/src/mojo/public/cpp/system/core.h" | 11 #include "mojo/public/c/system/handle.h" |
| 12 #include "mojo/public/c/system/result.h" |
| 13 #include "mojo/public/cpp/system/macros.h" |
11 | 14 |
12 namespace mojo { | 15 namespace mojo { |
13 | 16 |
14 class ApplicationDelegate; | 17 class ApplicationDelegate; |
15 | 18 |
16 // A utility for running a chromium based mojo Application. The typical use | 19 // A utility for running a chromium based mojo Application. The typical use |
17 // case is to use when writing your MojoMain: | 20 // case is to use when writing your MojoMain: |
18 // | 21 // |
19 // MojoResult MojoMain(MojoHandle application_request) { | 22 // MojoResult MojoMain(MojoHandle application_request) { |
20 // mojo::ApplicationRunnerChromium runner(new MyDelegate()); | 23 // mojo::ApplicationRunnerChromium runner(new MyDelegate()); |
(...skipping 10 matching lines...) Expand all Loading... |
31 ~ApplicationRunnerChromium(); | 34 ~ApplicationRunnerChromium(); |
32 | 35 |
33 void set_message_loop_type(base::MessageLoop::Type type); | 36 void set_message_loop_type(base::MessageLoop::Type type); |
34 | 37 |
35 // Once the various parameters have been set above, use Run to initialize an | 38 // Once the various parameters have been set above, use Run to initialize an |
36 // ApplicationImpl wired to the provided delegate, and run a MessageLoop until | 39 // ApplicationImpl wired to the provided delegate, and run a MessageLoop until |
37 // the application exits. | 40 // the application exits. |
38 MojoResult Run(MojoHandle application_request); | 41 MojoResult Run(MojoHandle application_request); |
39 | 42 |
40 private: | 43 private: |
41 scoped_ptr<ApplicationDelegate> delegate_; | 44 std::unique_ptr<ApplicationDelegate> delegate_; |
42 | 45 |
43 // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as | 46 // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as |
44 // the underlying message pump). | 47 // the underlying message pump). |
45 base::MessageLoop::Type message_loop_type_; | 48 base::MessageLoop::Type message_loop_type_; |
46 // Whether Run() has been called. | 49 // Whether Run() has been called. |
47 bool has_run_; | 50 bool has_run_; |
48 | 51 |
49 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationRunnerChromium); | 52 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationRunnerChromium); |
50 }; | 53 }; |
51 | 54 |
52 } // namespace mojo | 55 } // namespace mojo |
53 | 56 |
54 #endif // MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_ | 57 #endif // MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_ |
OLD | NEW |