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

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

Issue 1354003002: Make CapabilityFilter be part of Identity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 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
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_CONNECT_TO_APPLICATION_PARAMS_H_ 5 #ifndef MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_
6 #define MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ 6 #define MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "mojo/application/public/interfaces/service_provider.mojom.h" 11 #include "mojo/application/public/interfaces/service_provider.mojom.h"
12 #include "mojo/application/public/interfaces/shell.mojom.h" 12 #include "mojo/application/public/interfaces/shell.mojom.h"
13 #include "mojo/public/cpp/bindings/interface_request.h" 13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" 14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
15 #include "mojo/shell/capability_filter.h"
16 #include "mojo/shell/identity.h" 15 #include "mojo/shell/identity.h"
17 #include "url/gurl.h" 16 #include "url/gurl.h"
18 17
19 namespace mojo { 18 namespace mojo {
20 namespace shell { 19 namespace shell {
21 20
22 class ApplicationInstance; 21 class ApplicationInstance;
23 22
24 // This class represents a request for the application manager to connect to an 23 // This class represents a request for the application manager to connect to an
25 // application. 24 // application.
26 class ConnectToApplicationParams { 25 class ConnectToApplicationParams {
27 public: 26 public:
28 ConnectToApplicationParams(); 27 ConnectToApplicationParams();
29 ~ConnectToApplicationParams(); 28 ~ConnectToApplicationParams();
30 29
31 // Sets both |originator_identity_| and |originator_filter_|. If |originator| 30 // Sets |source_|. If |source| is null, |source_| is reset.
32 // is null, both fields are reset. 31 void SetSource(ApplicationInstance* source);
33 void SetOriginatorInfo(ApplicationInstance* originator);
34 32
35 // Sets both |app_url_| and |app_url_request_|. 33 // Sets both |target_| and |target_url_request_|.
36 void SetURLInfo(const GURL& app_url); 34 void SetTarget(const Identity& target);
37 // Sets both |app_url_| and |app_url_request_|. 35 void SetTargetURL(const GURL& target_url);
38 void SetURLInfo(URLRequestPtr app_url_request); 36 // Sets both |target_| and |target_url_request_|.
yzshen1 2015/09/18 06:07:54 nit: please consider removing this comment and cha
37 void SetTargetURLRequest(URLRequestPtr request);
38 void SetTargetURLRequest(URLRequestPtr request, const Identity& target);
39 39
40 void set_originator_identity(const Identity& value) { 40 void set_source(const Identity& source) { source_ = source; }
41 originator_identity_ = value; 41 const Identity& source() const { return source_; }
42 const GURL& target_url() const { return target_.url; }
43 const Identity& target() const { return target_; }
44
45 const URLRequest* target_url_request() const {
46 return target_url_request_.get();
42 } 47 }
43 const Identity& originator_identity() const { return originator_identity_; } 48 // NOTE: This doesn't reset |target_|.
44 49 URLRequestPtr TakeTargetURLRequest() { return target_url_request_.Pass(); }
45 void set_originator_filter(const CapabilityFilter& value) {
46 originator_filter_ = value;
47 }
48 const CapabilityFilter& originator_filter() const {
49 return originator_filter_;
50 }
51
52 const GURL& app_url() const { return app_url_; }
53
54 const URLRequest* app_url_request() const { return app_url_request_.get(); }
55 // NOTE: This doesn't reset |app_url_|.
56 URLRequestPtr TakeAppURLRequest() { return app_url_request_.Pass(); }
57
58 void set_qualifier(const std::string& value) { qualifier_ = value; }
59 const std::string& qualifier() const { return qualifier_; }
60 50
61 void set_services(InterfaceRequest<ServiceProvider> value) { 51 void set_services(InterfaceRequest<ServiceProvider> value) {
62 services_ = value.Pass(); 52 services_ = value.Pass();
63 } 53 }
64 InterfaceRequest<ServiceProvider> TakeServices() { return services_.Pass(); } 54 InterfaceRequest<ServiceProvider> TakeServices() { return services_.Pass(); }
65 55
66 void set_exposed_services(ServiceProviderPtr value) { 56 void set_exposed_services(ServiceProviderPtr value) {
67 exposed_services_ = value.Pass(); 57 exposed_services_ = value.Pass();
68 } 58 }
69 ServiceProviderPtr TakeExposedServices() { return exposed_services_.Pass(); } 59 ServiceProviderPtr TakeExposedServices() { return exposed_services_.Pass(); }
70 60
71 void set_filter(const CapabilityFilter& value) { filter_ = value; }
72 const CapabilityFilter& filter() const { return filter_; }
73
74 void set_on_application_end(const base::Closure& value) { 61 void set_on_application_end(const base::Closure& value) {
75 on_application_end_ = value; 62 on_application_end_ = value;
76 } 63 }
77 const base::Closure& on_application_end() const { 64 const base::Closure& on_application_end() const {
78 return on_application_end_; 65 return on_application_end_;
79 } 66 }
80 67
81 void set_connect_callback(const Shell::ConnectToApplicationCallback& value) { 68 void set_connect_callback(const Shell::ConnectToApplicationCallback& value) {
82 connect_callback_ = value; 69 connect_callback_ = value;
83 } 70 }
84 const Shell::ConnectToApplicationCallback& connect_callback() const { 71 const Shell::ConnectToApplicationCallback& connect_callback() const {
85 return connect_callback_; 72 return connect_callback_;
86 } 73 }
87 74
88 private: 75 private:
89 // It may be null (i.e., is_null() returns true) which indicates that there is 76 // It may be null (i.e., is_null() returns true) which indicates that there is
90 // no originator (e.g., for the first application or in tests). 77 // no source (e.g., for the first application or in tests).
91 Identity originator_identity_; 78 Identity source_;
92 // Should be ignored if |originator_identity_| is null. 79 // The identity of the application being connected to.
93 CapabilityFilter originator_filter_; 80 Identity target_;
94 // The URL of the application that is being connected to.
95 GURL app_url_;
96 // The URL request to fetch the application. It may contain more information 81 // The URL request to fetch the application. It may contain more information
97 // than |app_url_| (e.g., headers, request body). When it is taken, |app_url_| 82 // than |app_url_| (e.g., headers, request body). When it is taken, |app_url_|
yzshen1 2015/09/18 06:07:54 Please update |app_ur_| related comments.
98 // remains unchanged. 83 // remains unchanged.
99 URLRequestPtr app_url_request_; 84 URLRequestPtr target_url_request_;
100 // Please see the comments in identity.h for the exact meaning of qualifier. 85
101 std::string qualifier_;
102 InterfaceRequest<ServiceProvider> services_; 86 InterfaceRequest<ServiceProvider> services_;
103 ServiceProviderPtr exposed_services_; 87 ServiceProviderPtr exposed_services_;
104 CapabilityFilter filter_;
105 base::Closure on_application_end_; 88 base::Closure on_application_end_;
106 Shell::ConnectToApplicationCallback connect_callback_; 89 Shell::ConnectToApplicationCallback connect_callback_;
107 90
108 DISALLOW_COPY_AND_ASSIGN(ConnectToApplicationParams); 91 DISALLOW_COPY_AND_ASSIGN(ConnectToApplicationParams);
109 }; 92 };
110 93
111 } // namespace shell 94 } // namespace shell
112 } // namespace mojo 95 } // namespace mojo
113 96
114 #endif // MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_ 97 #endif // MOJO_SHELL_CONNECT_TO_APPLICATION_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698