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

Side by Side Diff: ios/web/public/test/fakes/test_web_state_delegate.mm

Issue 2737353006: Replaced webPageOrderedClose with WebStateDelegate API. (Closed)
Patch Set: Created 3 years, 9 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 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" 8 #import "ios/web/web_state/web_state_impl.h"
9 9
10 namespace web { 10 namespace web {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 std::unique_ptr<WebStateImpl> child( 58 std::unique_ptr<WebStateImpl> child(
59 base::MakeUnique<WebStateImpl>(source->GetBrowserState())); 59 base::MakeUnique<WebStateImpl>(source->GetBrowserState()));
60 child->GetNavigationManagerImpl().InitializeSession(YES /*opened_by_dom*/); 60 child->GetNavigationManagerImpl().InitializeSession(YES /*opened_by_dom*/);
61 child->SetWebUsageEnabled(true); 61 child->SetWebUsageEnabled(true);
62 62
63 child_windows_.push_back(std::move(child)); 63 child_windows_.push_back(std::move(child));
64 return child_windows_.back().get(); 64 return child_windows_.back().get();
65 } 65 }
66 66
67 void TestWebStateDelegate::CloseWebState(WebState* source) {
68 last_close_web_state_request_ = base::MakeUnique<TestCloseWebStateRequest>();
69 last_close_web_state_request_->web_state = source;
70
71 // Remove WebState from |child_windows_|.
72 for (size_t i = 0; i < child_windows_.size(); i++) {
73 if (child_windows_[i].get() == source) {
74 child_windows_.erase(child_windows_.begin() + i);
rohitrao (ping after 24h) 2017/03/13 12:30:02 If the WebState is owned by child_windows_, we des
Eugene But (OOO till 7-30) 2017/03/14 01:20:24 Good catch. Fixed by having |closed_child_windows_
75 break;
76 }
77 }
78 }
79
67 WebState* TestWebStateDelegate::OpenURLFromWebState( 80 WebState* TestWebStateDelegate::OpenURLFromWebState(
68 WebState* web_state, 81 WebState* web_state,
69 const WebState::OpenURLParams& params) { 82 const WebState::OpenURLParams& params) {
70 last_open_url_request_ = base::MakeUnique<TestOpenURLRequest>(); 83 last_open_url_request_ = base::MakeUnique<TestOpenURLRequest>();
71 last_open_url_request_->web_state = web_state; 84 last_open_url_request_->web_state = web_state;
72 last_open_url_request_->params = params; 85 last_open_url_request_->params = params;
73 return nullptr; 86 return nullptr;
74 } 87 }
75 88
76 JavaScriptDialogPresenter* TestWebStateDelegate::GetJavaScriptDialogPresenter( 89 JavaScriptDialogPresenter* TestWebStateDelegate::GetJavaScriptDialogPresenter(
(...skipping 28 matching lines...) Expand all
105 const AuthCallback& callback) { 118 const AuthCallback& callback) {
106 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>(); 119 last_authentication_request_ = base::MakeUnique<TestAuthenticationRequest>();
107 last_authentication_request_->web_state = source; 120 last_authentication_request_->web_state = source;
108 last_authentication_request_->protection_space.reset( 121 last_authentication_request_->protection_space.reset(
109 [protection_space retain]); 122 [protection_space retain]);
110 last_authentication_request_->credential.reset([credential retain]); 123 last_authentication_request_->credential.reset([credential retain]);
111 last_authentication_request_->auth_callback = callback; 124 last_authentication_request_->auth_callback = callback;
112 } 125 }
113 126
114 } // namespace web 127 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698