| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/web/public/test/fakes/test_web_state_delegate.h" | 5 #import "ios/web/public/test/fakes/test_web_state_delegate.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #import "ios/web/web_state/web_state_impl.h" | |
| 9 | 8 |
| 10 namespace web { | 9 namespace web { |
| 11 | 10 |
| 12 TestOpenURLRequest::TestOpenURLRequest() | 11 TestOpenURLRequest::TestOpenURLRequest() |
| 13 : params(GURL(), | 12 : params(GURL(), |
| 14 Referrer(), | 13 Referrer(), |
| 15 WindowOpenDisposition::UNKNOWN, | 14 WindowOpenDisposition::UNKNOWN, |
| 16 ui::PAGE_TRANSITION_LINK, | 15 ui::PAGE_TRANSITION_LINK, |
| 17 false) {} | 16 false) {} |
| 18 | 17 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 last_create_new_web_state_request_->url = url; | 47 last_create_new_web_state_request_->url = url; |
| 49 last_create_new_web_state_request_->opener_url = opener_url; | 48 last_create_new_web_state_request_->opener_url = opener_url; |
| 50 last_create_new_web_state_request_->initiated_by_user = initiated_by_user; | 49 last_create_new_web_state_request_->initiated_by_user = initiated_by_user; |
| 51 | 50 |
| 52 if (!initiated_by_user && | 51 if (!initiated_by_user && |
| 53 allowed_popups_.find(opener_url) == allowed_popups_.end()) { | 52 allowed_popups_.find(opener_url) == allowed_popups_.end()) { |
| 54 popups_.push_back(TestPopup(url, opener_url)); | 53 popups_.push_back(TestPopup(url, opener_url)); |
| 55 return nullptr; | 54 return nullptr; |
| 56 } | 55 } |
| 57 | 56 |
| 58 std::unique_ptr<WebStateImpl> child( | 57 web::WebState::CreateParams params(source->GetBrowserState()); |
| 59 base::MakeUnique<WebStateImpl>(source->GetBrowserState())); | 58 params.created_with_opener = true; |
| 60 child->GetNavigationManagerImpl().InitializeSession(YES /*opened_by_dom*/); | 59 std::unique_ptr<web::WebState> child = web::WebState::Create(params); |
| 61 child->SetWebUsageEnabled(true); | 60 child->SetWebUsageEnabled(true); |
| 62 | 61 |
| 63 child_windows_.push_back(std::move(child)); | 62 child_windows_.push_back(std::move(child)); |
| 64 return child_windows_.back().get(); | 63 return child_windows_.back().get(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 void TestWebStateDelegate::CloseWebState(WebState* source) { | 66 void TestWebStateDelegate::CloseWebState(WebState* source) { |
| 68 last_close_web_state_request_ = base::MakeUnique<TestCloseWebStateRequest>(); | 67 last_close_web_state_request_ = base::MakeUnique<TestCloseWebStateRequest>(); |
| 69 last_close_web_state_request_->web_state = source; | 68 last_close_web_state_request_->web_state = source; |
| 70 | 69 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 const AuthCallback& callback) { | 118 const AuthCallback& callback) { |
| 120 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); | 119 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); |
| 121 last_authentication_request_->web_state = source; | 120 last_authentication_request_->web_state = source; |
| 122 last_authentication_request_->protection_space.reset( | 121 last_authentication_request_->protection_space.reset( |
| 123 [protection_space retain]); | 122 [protection_space retain]); |
| 124 last_authentication_request_->credential.reset([credential retain]); | 123 last_authentication_request_->credential.reset([credential retain]); |
| 125 last_authentication_request_->auth_callback = callback; | 124 last_authentication_request_->auth_callback = callback; |
| 126 } | 125 } |
| 127 | 126 |
| 128 } // namespace web | 127 } // namespace web |
| OLD | NEW |