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

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

Issue 1706063002: Eliminate ShellClientFactoryConnection & just have the ApplicationManager do it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@factory
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/BUILD.gn ('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 15 matching lines...) Expand all
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::Shell,
34 public mojom::PIDReceiver { 34 public mojom::PIDReceiver {
35 public: 35 public:
36 // |requesting_shell_client_factory_id| is the id of the factory that
37 // loaded this app. If the app was not loaded by a factory the id
38 // is kInvalidApplicationID.
39 ApplicationInstance( 36 ApplicationInstance(
40 mojom::ShellClientPtr shell_client, 37 mojom::ShellClientPtr shell_client,
41 ApplicationManager* manager, 38 ApplicationManager* manager,
42 const Identity& identity, 39 const Identity& identity,
43 uint32_t requesting_shell_client_factory_id,
44 const mojom::Shell::ConnectToApplicationCallback& connect_callback, 40 const mojom::Shell::ConnectToApplicationCallback& connect_callback,
45 const base::Closure& on_application_end, 41 const base::Closure& on_application_end,
46 const String& application_name); 42 const String& application_name);
47 43
48 ~ApplicationInstance() override; 44 ~ApplicationInstance() override;
49 45
50 void InitializeApplication(); 46 void InitializeApplication();
51 47
52 void ConnectToClient(scoped_ptr<ConnectToApplicationParams> params); 48 void ConnectToClient(scoped_ptr<ConnectToApplicationParams> params);
53 49
54 // Required before GetProcessId can be called. 50 // Required before GetProcessId can be called.
55 void SetNativeRunner(NativeRunner* native_runner); 51 void SetNativeRunner(NativeRunner* native_runner);
56 52
57 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); 53 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver);
58 54
59 void RunConnectCallback(); 55 void RunConnectCallback();
60 56
61 mojom::ShellClient* shell_client() { return shell_client_.get(); } 57 mojom::ShellClient* shell_client() { return shell_client_.get(); }
62 const Identity& identity() const { return identity_; } 58 const Identity& identity() const { return identity_; }
63 uint32_t id() const { return id_; } 59 uint32_t id() const { return id_; }
64 base::ProcessId pid() const { return pid_; } 60 base::ProcessId pid() const { return pid_; }
65 void set_pid(base::ProcessId pid) { pid_ = pid; } 61 void set_pid(base::ProcessId pid) { pid_ = pid; }
66 base::Closure on_application_end() const { return on_application_end_; } 62 base::Closure on_application_end() const { return on_application_end_; }
67 void set_requesting_shell_client_factory_id(uint32_t id) {
68 requesting_shell_client_factory_id_ = id;
69 }
70 uint32_t requesting_shell_client_factory_id() const {
71 return requesting_shell_client_factory_id_;
72 }
73 const String& application_name() const { return application_name_; } 63 const String& application_name() const { return application_name_; }
74 64
75 private: 65 private:
76 // Shell implementation: 66 // Shell implementation:
77 void ConnectToApplication( 67 void ConnectToApplication(
78 URLRequestPtr app_request, 68 URLRequestPtr app_request,
79 shell::mojom::InterfaceProviderRequest remote_interfaces, 69 shell::mojom::InterfaceProviderRequest remote_interfaces,
80 shell::mojom::InterfaceProviderPtr local_interfaces, 70 shell::mojom::InterfaceProviderPtr local_interfaces,
81 mojom::CapabilityFilterPtr filter, 71 mojom::CapabilityFilterPtr filter,
82 const ConnectToApplicationCallback& callback) override; 72 const ConnectToApplicationCallback& callback) override;
(...skipping 12 matching lines...) Expand all
95 85
96 void DestroyRunner(); 86 void DestroyRunner();
97 87
98 ApplicationManager* const manager_; 88 ApplicationManager* const manager_;
99 // An id that identifies this instance. Distinct from pid, as a single process 89 // An id that identifies this instance. Distinct from pid, as a single process
100 // may vend multiple application instances, and this object may exist before a 90 // may vend multiple application instances, and this object may exist before a
101 // process is launched. 91 // process is launched.
102 const uint32_t id_; 92 const uint32_t id_;
103 const Identity identity_; 93 const Identity identity_;
104 const bool allow_any_application_; 94 const bool allow_any_application_;
105 uint32_t requesting_shell_client_factory_id_;
106 mojom::Shell::ConnectToApplicationCallback connect_callback_; 95 mojom::Shell::ConnectToApplicationCallback connect_callback_;
107 base::Closure on_application_end_; 96 base::Closure on_application_end_;
108 mojom::ShellClientPtr shell_client_; 97 mojom::ShellClientPtr shell_client_;
109 Binding<mojom::Shell> binding_; 98 Binding<mojom::Shell> binding_;
110 Binding<mojom::PIDReceiver> pid_receiver_binding_; 99 Binding<mojom::PIDReceiver> pid_receiver_binding_;
111 bool queue_requests_; 100 bool queue_requests_;
112 std::vector<ConnectToApplicationParams*> queued_client_requests_; 101 std::vector<ConnectToApplicationParams*> queued_client_requests_;
113 NativeRunner* native_runner_; 102 NativeRunner* native_runner_;
114 const String application_name_; 103 const String application_name_;
115 base::ProcessId pid_; 104 base::ProcessId pid_;
116 105
117 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); 106 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance);
118 }; 107 };
119 108
120 } // namespace shell 109 } // namespace shell
121 } // namespace mojo 110 } // namespace mojo
122 111
123 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ 112 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_
OLDNEW
« no previous file with comments | « mojo/shell/BUILD.gn ('k') | mojo/shell/application_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698