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

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

Issue 1679573002: Move shell interfaces into the shell.mojom namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
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 | « mash/wm/root_window_controller.cc ('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 Shell, 33 class ApplicationInstance : public mojom::Shell,
34 public mojom::PIDReceiver { 34 public mojom::PIDReceiver {
35 public: 35 public:
36 // |requesting_content_handler_id| is the id of the content handler that 36 // |requesting_content_handler_id| is the id of the content handler that
37 // loaded this app. If the app was not loaded by a content handler the id 37 // loaded this app. If the app was not loaded by a content handler the id
38 // is kInvalidContentHandlerID. 38 // is kInvalidContentHandlerID.
39 ApplicationInstance(ApplicationPtr application, 39 ApplicationInstance(mojom::ApplicationPtr application,
40 ApplicationManager* manager, 40 ApplicationManager* manager,
41 const Identity& identity, 41 const Identity& identity,
42 uint32_t requesting_content_handler_id, 42 uint32_t requesting_content_handler_id,
43 const base::Closure& on_application_end); 43 const base::Closure& on_application_end);
44 44
45 ~ApplicationInstance() override; 45 ~ApplicationInstance() override;
46 46
47 void InitializeApplication(); 47 void InitializeApplication();
48 48
49 void ConnectToClient(scoped_ptr<ConnectToApplicationParams> params); 49 void ConnectToClient(scoped_ptr<ConnectToApplicationParams> params);
50 50
51 // Required before GetProcessId can be called. 51 // Required before GetProcessId can be called.
52 void SetNativeRunner(NativeRunner* native_runner); 52 void SetNativeRunner(NativeRunner* native_runner);
53 53
54 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver); 54 void BindPIDReceiver(InterfaceRequest<mojom::PIDReceiver> pid_receiver);
55 55
56 Application* application() { return application_.get(); } 56 mojom::Application* application() { return application_.get(); }
57 const Identity& identity() const { return identity_; } 57 const Identity& identity() const { return identity_; }
58 uint32_t id() const { return id_; } 58 uint32_t id() const { return id_; }
59 base::ProcessId pid() const { return pid_; } 59 base::ProcessId pid() const { return pid_; }
60 void set_pid(base::ProcessId pid) { pid_ = pid; } 60 void set_pid(base::ProcessId pid) { pid_ = pid; }
61 base::Closure on_application_end() const { return on_application_end_; } 61 base::Closure on_application_end() const { return on_application_end_; }
62 void set_requesting_content_handler_id(uint32_t id) { 62 void set_requesting_content_handler_id(uint32_t id) {
63 requesting_content_handler_id_ = id; 63 requesting_content_handler_id_ = id;
64 } 64 }
65 uint32_t requesting_content_handler_id() const { 65 uint32_t requesting_content_handler_id() const {
66 return requesting_content_handler_id_; 66 return requesting_content_handler_id_;
67 } 67 }
68 68
69 private: 69 private:
70 // Shell implementation: 70 // Shell implementation:
71 void ConnectToApplication( 71 void ConnectToApplication(
72 URLRequestPtr app_request, 72 URLRequestPtr app_request,
73 InterfaceRequest<ServiceProvider> services, 73 InterfaceRequest<ServiceProvider> services,
74 ServiceProviderPtr exposed_services, 74 ServiceProviderPtr exposed_services,
75 CapabilityFilterPtr filter, 75 mojom::CapabilityFilterPtr filter,
76 const ConnectToApplicationCallback& callback) override; 76 const ConnectToApplicationCallback& callback) override;
77 void QuitApplication() override; 77 void QuitApplication() override;
78 78
79 // PIDReceiver implementation: 79 // PIDReceiver implementation:
80 void SetPID(uint32_t pid) override; 80 void SetPID(uint32_t pid) override;
81 81
82 uint32_t GenerateUniqueID() const; 82 uint32_t GenerateUniqueID() const;
83 83
84 void CallAcceptConnection(scoped_ptr<ConnectToApplicationParams> params); 84 void CallAcceptConnection(scoped_ptr<ConnectToApplicationParams> params);
85 85
86 void OnConnectionError(); 86 void OnConnectionError();
87 87
88 void OnQuitRequestedResult(bool can_quit); 88 void OnQuitRequestedResult(bool can_quit);
89 89
90 void DestroyRunner(); 90 void DestroyRunner();
91 91
92 ApplicationManager* const manager_; 92 ApplicationManager* const manager_;
93 // An id that identifies this instance. Distinct from pid, as a single process 93 // An id that identifies this instance. Distinct from pid, as a single process
94 // may vend multiple application instances, and this object may exist before a 94 // may vend multiple application instances, and this object may exist before a
95 // process is launched. 95 // process is launched.
96 const uint32_t id_; 96 const uint32_t id_;
97 const Identity identity_; 97 const Identity identity_;
98 const bool allow_any_application_; 98 const bool allow_any_application_;
99 uint32_t requesting_content_handler_id_; 99 uint32_t requesting_content_handler_id_;
100 base::Closure on_application_end_; 100 base::Closure on_application_end_;
101 ApplicationPtr application_; 101 mojom::ApplicationPtr application_;
102 Binding<Shell> binding_; 102 Binding<mojom::Shell> binding_;
103 Binding<mojom::PIDReceiver> pid_receiver_binding_; 103 Binding<mojom::PIDReceiver> pid_receiver_binding_;
104 bool queue_requests_; 104 bool queue_requests_;
105 std::vector<ConnectToApplicationParams*> queued_client_requests_; 105 std::vector<ConnectToApplicationParams*> queued_client_requests_;
106 NativeRunner* native_runner_; 106 NativeRunner* native_runner_;
107 base::ProcessId pid_; 107 base::ProcessId pid_;
108 108
109 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance); 109 DISALLOW_COPY_AND_ASSIGN(ApplicationInstance);
110 }; 110 };
111 111
112 } // namespace shell 112 } // namespace shell
113 } // namespace mojo 113 } // namespace mojo
114 114
115 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_ 115 #endif // MOJO_SHELL_APPLICATION_INSTANCE_H_
OLDNEW
« no previous file with comments | « mash/wm/root_window_controller.cc ('k') | mojo/shell/application_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698