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

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

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

Powered by Google App Engine
This is Rietveld 408576698