Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: services/shell/public/cpp/application_runner.h

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/shell/public/cpp/BUILD.gn ('k') | services/shell/public/cpp/connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SERVICES_SHELL_PUBLIC_CPP_APPLICATION_RUNNER_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_APPLICATION_RUNNER_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_APPLICATION_RUNNER_H_ 6 #define SERVICES_SHELL_PUBLIC_CPP_APPLICATION_RUNNER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "mojo/public/cpp/system/core.h" 11 #include "mojo/public/cpp/system/core.h"
12 12
13 namespace shell { 13 namespace shell {
14 14
15 class ShellClient; 15 class Service;
16 class ShellConnection; 16 class ShellConnection;
17 17
18 // A utility for running a chromium based mojo Application. The typical use 18 // A utility for running a chromium based mojo Application. The typical use
19 // case is to use when writing your MojoMain: 19 // case is to use when writing your MojoMain:
20 // 20 //
21 // MojoResult MojoMain(MojoHandle shell_handle) { 21 // MojoResult MojoMain(MojoHandle shell_handle) {
22 // shell::ApplicationRunner runner(new MyDelegate()); 22 // shell::ApplicationRunner runner(new MyDelegate());
23 // return runner.Run(shell_handle); 23 // return runner.Run(shell_handle);
24 // } 24 // }
25 // 25 //
26 // ApplicationRunner takes care of chromium environment initialization and 26 // ApplicationRunner takes care of chromium environment initialization and
27 // shutdown, and starting a MessageLoop from which your application can run and 27 // shutdown, and starting a MessageLoop from which your application can run and
28 // ultimately Quit(). 28 // ultimately Quit().
29 class ApplicationRunner { 29 class ApplicationRunner {
30 public: 30 public:
31 // Takes ownership of |client|. 31 // Takes ownership of |client|.
32 explicit ApplicationRunner(ShellClient* client); 32 explicit ApplicationRunner(Service* client);
33 ~ApplicationRunner(); 33 ~ApplicationRunner();
34 34
35 static void InitBaseCommandLine(); 35 static void InitBaseCommandLine();
36 36
37 void set_message_loop_type(base::MessageLoop::Type type); 37 void set_message_loop_type(base::MessageLoop::Type type);
38 38
39 // Once the various parameters have been set above, use Run to initialize an 39 // Once the various parameters have been set above, use Run to initialize an
40 // ShellConnection wired to the provided delegate, and run a MessageLoop until 40 // ShellConnection wired to the provided delegate, and run a MessageLoop until
41 // the application exits. 41 // the application exits.
42 // 42 //
(...skipping 10 matching lines...) Expand all
53 // this application, though this application may continue to run and service 53 // this application, though this application may continue to run and service
54 // requests from others. 54 // requests from others.
55 void DestroyShellConnection(); 55 void DestroyShellConnection();
56 56
57 // Allows the caller to explicitly quit the application. Must be called from 57 // Allows the caller to explicitly quit the application. Must be called from
58 // the thread which created the ApplicationRunner. 58 // the thread which created the ApplicationRunner.
59 void Quit(); 59 void Quit();
60 60
61 private: 61 private:
62 std::unique_ptr<ShellConnection> connection_; 62 std::unique_ptr<ShellConnection> connection_;
63 std::unique_ptr<ShellClient> client_; 63 std::unique_ptr<Service> client_;
64 64
65 // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as 65 // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as
66 // the underlying message pump). 66 // the underlying message pump).
67 base::MessageLoop::Type message_loop_type_; 67 base::MessageLoop::Type message_loop_type_;
68 // Whether Run() has been called. 68 // Whether Run() has been called.
69 bool has_run_; 69 bool has_run_;
70 70
71 DISALLOW_COPY_AND_ASSIGN(ApplicationRunner); 71 DISALLOW_COPY_AND_ASSIGN(ApplicationRunner);
72 }; 72 };
73 73
74 } // namespace shell 74 } // namespace shell
75 75
76 #endif // SERVICES_SHELL_PUBLIC_CPP_APPLICATION_RUNNER_H_ 76 #endif // SERVICES_SHELL_PUBLIC_CPP_APPLICATION_RUNNER_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/BUILD.gn ('k') | services/shell/public/cpp/connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698