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

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

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/application_test_base.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 "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 "mojo/public/cpp/system/core.h" 11 #include "mojo/public/cpp/system/core.h"
11 12
12 namespace mojo { 13 namespace shell {
13 14
14 class ShellClient; 15 class ShellClient;
15 class ShellConnection; 16 class ShellConnection;
16 17
17 // 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
18 // case is to use when writing your MojoMain: 19 // case is to use when writing your MojoMain:
19 // 20 //
20 // MojoResult MojoMain(MojoHandle shell_handle) { 21 // MojoResult MojoMain(MojoHandle shell_handle) {
21 // mojo::ApplicationRunner runner(new MyDelegate()); 22 // shell::ApplicationRunner runner(new MyDelegate());
22 // return runner.Run(shell_handle); 23 // return runner.Run(shell_handle);
23 // } 24 // }
24 // 25 //
25 // ApplicationRunner takes care of chromium environment initialization and 26 // ApplicationRunner takes care of chromium environment initialization and
26 // 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
27 // ultimately Quit(). 28 // ultimately Quit().
28 class ApplicationRunner { 29 class ApplicationRunner {
29 public: 30 public:
30 // Takes ownership of |client|. 31 // Takes ownership of |client|.
31 explicit ApplicationRunner(ShellClient* client); 32 explicit ApplicationRunner(ShellClient* client);
(...skipping 19 matching lines...) Expand all
51 // shell notices the pipe has closed, it will no longer track an instance of 52 // shell notices the pipe has closed, it will no longer track an instance of
52 // this application, though this application may continue to run and service 53 // this application, though this application may continue to run and service
53 // requests from others. 54 // requests from others.
54 void DestroyShellConnection(); 55 void DestroyShellConnection();
55 56
56 // 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
57 // the thread which created the ApplicationRunner. 58 // the thread which created the ApplicationRunner.
58 void Quit(); 59 void Quit();
59 60
60 private: 61 private:
61 scoped_ptr<ShellConnection> connection_; 62 std::unique_ptr<ShellConnection> connection_;
62 scoped_ptr<ShellClient> client_; 63 std::unique_ptr<ShellClient> client_;
63 64
64 // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as 65 // MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as
65 // the underlying message pump). 66 // the underlying message pump).
66 base::MessageLoop::Type message_loop_type_; 67 base::MessageLoop::Type message_loop_type_;
67 // Whether Run() has been called. 68 // Whether Run() has been called.
68 bool has_run_; 69 bool has_run_;
69 70
70 DISALLOW_COPY_AND_ASSIGN(ApplicationRunner); 71 DISALLOW_COPY_AND_ASSIGN(ApplicationRunner);
71 }; 72 };
72 73
73 } // namespace mojo 74 } // namespace shell
74 75
75 #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/application_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698