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

Side by Side Diff: mojo/shell/application_instance.h

Issue 1736663003: Eliminate Quit() from Shell, and roll Shell & Connector together. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@14cf
Patch Set: . Created 4 years, 9 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 | « content/test/data/web_ui_mojo_shell_test.js ('k') | mojo/shell/application_instance.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_APPLICATION_INSTANCE_H_ 5 #ifndef MOJO_SHELL_APPLICATION_INSTANCE_H_
6 #define MOJO_SHELL_APPLICATION_INSTANCE_H_ 6 #define MOJO_SHELL_APPLICATION_INSTANCE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 12 matching lines...) Expand all
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 namespace mojo { 25 namespace mojo {
26 namespace shell { 26 namespace shell {
27 27
28 class ApplicationManager; 28 class ApplicationManager;
29 class NativeRunner; 29 class NativeRunner;
30 30
31 // Encapsulates a connection to an instance of an application, tracked by the 31 // Encapsulates a connection to an instance of an application, tracked by the
32 // shell's ApplicationManager. 32 // shell's ApplicationManager.
33 class ApplicationInstance : public mojom::Shell, 33 class ApplicationInstance : public mojom::Connector,
34 public mojom::Connector,
35 public mojom::PIDReceiver { 34 public mojom::PIDReceiver {
36 public: 35 public:
37 ApplicationInstance( 36 ApplicationInstance(
38 mojom::ShellClientPtr shell_client, 37 mojom::ShellClientPtr shell_client,
39 ApplicationManager* manager, 38 ApplicationManager* manager,
40 const Identity& identity); 39 const Identity& identity);
41 ~ApplicationInstance() override; 40 ~ApplicationInstance() override;
42 41
43 void InitializeApplication(); 42 void InitializeApplication();
44 43
45 void ConnectToClient(scoped_ptr<ConnectParams> params); 44 void ConnectToClient(scoped_ptr<ConnectParams> params);
46 45
47 // Required before GetProcessId can be called. 46 // Required before GetProcessId can be called.
48 void SetNativeRunner(NativeRunner* native_runner); 47 void SetNativeRunner(NativeRunner* native_runner);
49 48
50 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); 49 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver);
51 50
52 mojom::ShellClient* shell_client() { return shell_client_.get(); } 51 mojom::ShellClient* shell_client() { return shell_client_.get(); }
53 const Identity& identity() const { return identity_; } 52 const Identity& identity() const { return identity_; }
54 uint32_t id() const { return id_; } 53 uint32_t id() const { return id_; }
55 base::ProcessId pid() const { return pid_; } 54 base::ProcessId pid() const { return pid_; }
56 void set_pid(base::ProcessId pid) { pid_ = pid; } 55 void set_pid(base::ProcessId pid) { pid_ = pid; }
57 56
58 private: 57 private:
59 // Shell implementation:
60 void GetConnector(mojom::ConnectorRequest request) override;
61 void QuitApplication() override;
62
63 // Connector implementation: 58 // Connector implementation:
64 void Connect(const String& app_url, 59 void Connect(const String& app_url,
65 uint32_t user_id, 60 uint32_t user_id,
66 shell::mojom::InterfaceProviderRequest remote_interfaces, 61 shell::mojom::InterfaceProviderRequest remote_interfaces,
67 shell::mojom::InterfaceProviderPtr local_interfaces, 62 shell::mojom::InterfaceProviderPtr local_interfaces,
68 const ConnectCallback& callback) override; 63 const ConnectCallback& callback) override;
69 void Clone(mojom::ConnectorRequest request) override; 64 void Clone(mojom::ConnectorRequest request) override;
70 65
71 // PIDReceiver implementation: 66 // PIDReceiver implementation:
72 void SetPID(uint32_t pid) override; 67 void SetPID(uint32_t pid) override;
73 68
74 uint32_t GenerateUniqueID() const; 69 uint32_t GenerateUniqueID() const;
75 70
76 void CallAcceptConnection(scoped_ptr<ConnectParams> params);
77
78 void OnConnectionError();
79
80 void OnQuitRequestedResult(bool can_quit);
81
82 void DestroyRunner();
83
84 ApplicationManager* const manager_; 71 ApplicationManager* const manager_;
85 // An id that identifies this instance. Distinct from pid, as a single process 72 // An id that identifies this instance. Distinct from pid, as a single process
86 // may vend multiple application instances, and this object may exist before a 73 // may vend multiple application instances, and this object may exist before a
87 // process is launched. 74 // process is launched.
88 const uint32_t id_; 75 const uint32_t id_;
89 const Identity identity_; 76 const Identity identity_;
90 const bool allow_any_application_; 77 const bool allow_any_application_;
91 mojom::ShellClientPtr shell_client_; 78 mojom::ShellClientPtr shell_client_;
92 Binding<mojom::Shell> binding_;
93 Binding<mojom::PIDReceiver> pid_receiver_binding_; 79 Binding<mojom::PIDReceiver> pid_receiver_binding_;
94 BindingSet<mojom::Connector> connectors_; 80 BindingSet<mojom::Connector> connectors_;
95 bool queue_requests_;
96 std::vector<ConnectParams*> queued_client_requests_;
97 NativeRunner* native_runner_; 81 NativeRunner* native_runner_;
98 base::ProcessId pid_; 82 base::ProcessId pid_;
99 83
100 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); 84 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance);
101 }; 85 };
102 86
103 } // namespace shell 87 } // namespace shell
104 } // namespace mojo 88 } // namespace mojo
105 89
106 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ 90 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_
OLDNEW
« no previous file with comments | « content/test/data/web_ui_mojo_shell_test.js ('k') | mojo/shell/application_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698