OLD | NEW |
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 #include "mojo/shell/connect_to_application_params.h" | 5 #include "mojo/shell/connect_to_application_params.h" |
6 | 6 |
7 #include "mojo/shell/application_instance.h" | 7 #include "mojo/shell/application_instance.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace shell { | 10 namespace shell { |
11 | 11 |
12 ConnectToApplicationParams::ConnectToApplicationParams() {} | 12 ConnectToApplicationParams::ConnectToApplicationParams() {} |
13 | 13 |
14 ConnectToApplicationParams::~ConnectToApplicationParams() {} | 14 ConnectToApplicationParams::~ConnectToApplicationParams() {} |
15 | 15 |
16 void ConnectToApplicationParams::SetOriginatorInfo( | 16 void ConnectToApplicationParams::SetSource(ApplicationInstance* source) { |
17 ApplicationInstance* originator) { | 17 if (!source) { |
18 if (!originator) { | 18 source_ = Identity(); |
19 originator_identity_ = Identity(); | |
20 originator_filter_.clear(); | |
21 return; | 19 return; |
22 } | 20 } |
23 | 21 |
24 originator_identity_ = originator->identity(); | 22 source_ = source->identity(); |
25 originator_filter_ = originator->filter(); | |
26 } | 23 } |
27 | 24 |
28 void ConnectToApplicationParams::SetURLInfo(const GURL& app_url) { | 25 void ConnectToApplicationParams::SetTarget(const Identity& target) { |
29 app_url_ = app_url; | 26 target_ = target; |
30 app_url_request_ = URLRequest::New(); | 27 target_url_request_ = URLRequest::New(); |
31 app_url_request_->url = app_url_.spec(); | 28 target_url_request_->url = target_.url().spec(); |
32 } | 29 } |
33 | 30 |
34 void ConnectToApplicationParams::SetURLInfo(URLRequestPtr app_url_request) { | 31 void ConnectToApplicationParams::SetTargetURL(const GURL& target_url) { |
35 app_url_request_ = app_url_request.Pass(); | 32 target_ = Identity(target_url, target_.qualifier(), target_.filter()); |
36 app_url_ = app_url_request_ ? GURL(app_url_request_->url) : GURL(); | 33 target_url_request_ = URLRequest::New(); |
| 34 target_url_request_->url = target_.url().spec(); |
| 35 } |
| 36 |
| 37 void ConnectToApplicationParams::SetTargetURLRequest(URLRequestPtr request) { |
| 38 Identity target = request ? Identity(GURL(request->url), target_.qualifier(), |
| 39 target_.filter()) |
| 40 : Identity(); |
| 41 SetTargetURLRequest(request.Pass(), target); |
| 42 } |
| 43 |
| 44 void ConnectToApplicationParams::SetTargetURLRequest(URLRequestPtr request, |
| 45 const Identity& target) { |
| 46 target_url_request_ = request.Pass(); |
| 47 target_ = target; |
37 } | 48 } |
38 | 49 |
39 } // namespace shell | 50 } // namespace shell |
40 } // namespace mojo | 51 } // namespace mojo |
OLD | NEW |