| 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::SetSource(ApplicationInstance* source) { | 16 void ConnectToApplicationParams::SetOriginatorInfo( |
| 17 if (!source) { | 17 ApplicationInstance* originator) { |
| 18 source_ = Identity(); | 18 if (!originator) { |
| 19 originator_identity_ = Identity(); |
| 20 originator_filter_.clear(); |
| 19 return; | 21 return; |
| 20 } | 22 } |
| 21 | 23 |
| 22 source_ = source->identity(); | 24 originator_identity_ = originator->identity(); |
| 25 originator_filter_ = originator->filter(); |
| 23 } | 26 } |
| 24 | 27 |
| 25 void ConnectToApplicationParams::SetTarget(const Identity& target) { | 28 void ConnectToApplicationParams::SetURLInfo(const GURL& app_url) { |
| 26 target_ = target; | 29 app_url_ = app_url; |
| 27 target_url_request_ = URLRequest::New(); | 30 app_url_request_ = URLRequest::New(); |
| 28 target_url_request_->url = target_.url().spec(); | 31 app_url_request_->url = app_url_.spec(); |
| 29 } | 32 } |
| 30 | 33 |
| 31 void ConnectToApplicationParams::SetTargetURL(const GURL& target_url) { | 34 void ConnectToApplicationParams::SetURLInfo(URLRequestPtr app_url_request) { |
| 32 target_ = Identity(target_url, target_.qualifier(), target_.filter()); | 35 app_url_request_ = app_url_request.Pass(); |
| 33 target_url_request_ = URLRequest::New(); | 36 app_url_ = app_url_request_ ? GURL(app_url_request_->url) : GURL(); |
| 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; | |
| 48 } | 37 } |
| 49 | 38 |
| 50 } // namespace shell | 39 } // namespace shell |
| 51 } // namespace mojo | 40 } // namespace mojo |
| OLD | NEW |