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

Side by Side Diff: mojo/shell/standalone/context.h

Issue 1714753002: 7/ Eliminate on_application_end from ConnectParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client_request
Patch Set: . Created 4 years, 10 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 | « mojo/shell/identity.cc ('k') | mojo/shell/standalone/context.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SHELL_STANDALONE_CONTEXT_H_ 5 #ifndef MOJO_SHELL_STANDALONE_CONTEXT_H_
6 #define MOJO_SHELL_STANDALONE_CONTEXT_H_ 6 #define MOJO_SHELL_STANDALONE_CONTEXT_H_
7 7
8 #include <set>
9 #include <string>
10 #include <vector> 8 #include <vector>
11 9
12 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
13 #include "base/macros.h" 11 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
16 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
17 #include "base/time/time.h" 15 #include "base/time/time.h"
18 #include "mojo/edk/embedder/process_delegate.h" 16 #include "mojo/edk/embedder/process_delegate.h"
19 #include "mojo/shell/application_manager.h" 17 #include "mojo/shell/application_manager.h"
20 #include "mojo/shell/runner/host/command_line_switch.h" 18 #include "mojo/shell/runner/host/command_line_switch.h"
21 #include "mojo/shell/standalone/tracer.h" 19 #include "mojo/shell/standalone/tracer.h"
22 #include "url/gurl.h" 20 #include "url/gurl.h"
23 21
24 namespace base { 22 namespace base {
25 class SingleThreadTaskRunner; 23 class SingleThreadTaskRunner;
26 } 24 }
27 25
28 namespace mojo { 26 namespace mojo {
29 namespace shell { 27 namespace shell {
30 struct CommandLineSwitch; 28 struct CommandLineSwitch;
31 class NativeApplicationLoader;
32 29
33 // The "global" context for the shell's main process. 30 // The "global" context for the shell's main process.
34 class Context : public edk::ProcessDelegate { 31 class Context : public edk::ProcessDelegate {
35 public: 32 public:
36 Context(); 33 Context();
37 ~Context() override; 34 ~Context() override;
38 35
39 static void EnsureEmbedderIsInitialized(); 36 static void EnsureEmbedderIsInitialized();
40 37
41 void set_command_line_switches( 38 void set_command_line_switches(
42 const std::vector<CommandLineSwitch>& command_line_switches) { 39 const std::vector<CommandLineSwitch>& command_line_switches) {
43 command_line_switches_ = command_line_switches; 40 command_line_switches_ = command_line_switches;
44 } 41 }
45 42
46 // This must be called with a message loop set up for the current thread, 43 // This must be called with a message loop set up for the current thread,
47 // which must remain alive until after Shutdown() is called. 44 // which must remain alive until after Shutdown() is called.
48 void Init(const base::FilePath& shell_file_root); 45 void Init(const base::FilePath& shell_file_root);
49 46
50 // If Init() was called and succeeded, this must be called before destruction. 47 // If Init() was called and succeeded, this must be called before destruction.
51 void Shutdown(); 48 void Shutdown();
52 49
53 // NOTE: call either Run() or RunCommandLineApplication(), but not both. 50 // Run the application specified on the command line.
54 51 void RunCommandLineApplication();
55 // Runs the app specified by |url|.
56 void Run(const GURL& url);
57
58 // Run the application specified on the commandline. When the app finishes,
59 // |callback| is run if not null, otherwise the message loop is quit.
60 void RunCommandLineApplication(const base::Closure& callback);
61 52
62 ApplicationManager* application_manager() { 53 ApplicationManager* application_manager() {
63 return application_manager_.get(); 54 return application_manager_.get();
64 } 55 }
65 56
66 private: 57 private:
67 class NativeViewportApplicationLoader; 58 // edk::ProcessDelegate:
68
69 // ProcessDelegate implementation.
70 void OnShutdownComplete() override; 59 void OnShutdownComplete() override;
71 60
72 void OnApplicationEnd(const GURL& url); 61 // Runs the app specified by |url|.
73 62 void Run(const GURL& url);
74 std::set<GURL> app_urls_;
75 63
76 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_; 64 scoped_refptr<base::SingleThreadTaskRunner> shell_runner_;
77 scoped_ptr<base::Thread> io_thread_; 65 scoped_ptr<base::Thread> io_thread_;
78 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; 66 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
79 67
80 // Ensure this is destructed before task_runners_ since it owns a message pipe 68 // Ensure this is destructed before task_runners_ since it owns a message pipe
81 // that needs the IO thread to destruct cleanly. 69 // that needs the IO thread to destruct cleanly.
82 Tracer tracer_; 70 Tracer tracer_;
83 scoped_ptr<ApplicationManager> application_manager_; 71 scoped_ptr<ApplicationManager> application_manager_;
84 base::Closure app_complete_callback_;
85 base::Time main_entry_time_; 72 base::Time main_entry_time_;
86 std::vector<CommandLineSwitch> command_line_switches_; 73 std::vector<CommandLineSwitch> command_line_switches_;
87 74
88 DISALLOW_COPY_AND_ASSIGN(Context); 75 DISALLOW_COPY_AND_ASSIGN(Context);
89 }; 76 };
90 77
91 } // namespace shell 78 } // namespace shell
92 } // namespace mojo 79 } // namespace mojo
93 80
94 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_ 81 #endif // MOJO_SHELL_STANDALONE_CONTEXT_H_
OLDNEW
« no previous file with comments | « mojo/shell/identity.cc ('k') | mojo/shell/standalone/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698