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

Unified Diff: ios/web/public/test/fakes/test_web_state_delegate.mm

Issue 2737943003: Moved window opening callback to WebStateDelegate. (Closed)
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/public/test/fakes/test_web_state_delegate.h ('k') | ios/web/public/web_state/ui/crw_web_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/fakes/test_web_state_delegate.mm
diff --git a/ios/web/public/test/fakes/test_web_state_delegate.mm b/ios/web/public/test/fakes/test_web_state_delegate.mm
index 6019215f717b04425aa2ae8581d245ca1ab639d0..8263400e0778cacc73ef5c860e9d0ad4795dff76 100644
--- a/ios/web/public/test/fakes/test_web_state_delegate.mm
+++ b/ios/web/public/test/fakes/test_web_state_delegate.mm
@@ -5,6 +5,7 @@
#import "ios/web/public/test/fakes/test_web_state_delegate.h"
#include "base/memory/ptr_util.h"
+#import "ios/web/web_state/web_state_impl.h"
namespace web {
@@ -37,6 +38,32 @@ TestWebStateDelegate::TestWebStateDelegate() {}
TestWebStateDelegate::~TestWebStateDelegate() = default;
+WebState* TestWebStateDelegate::CreateNewWebState(WebState* source,
+ const GURL& url,
+ const GURL& opener_url,
+ bool initiated_by_user) {
+ last_create_new_web_state_request_ =
+ base::MakeUnique<TestCreateNewWebStateRequest>();
+ last_create_new_web_state_request_->web_state = source;
+ last_create_new_web_state_request_->url = url;
+ last_create_new_web_state_request_->opener_url = opener_url;
+ last_create_new_web_state_request_->initiated_by_user = initiated_by_user;
+
+ if (!initiated_by_user &&
+ allowed_popups_.find(opener_url) == allowed_popups_.end()) {
+ popups_.push_back(TestPopup(url, opener_url));
+ return nullptr;
+ }
+
+ std::unique_ptr<WebStateImpl> child(
+ base::MakeUnique<WebStateImpl>(source->GetBrowserState()));
+ child->GetNavigationManagerImpl().InitializeSession(YES /*opened_by_dom*/);
+ child->SetWebUsageEnabled(true);
+
+ child_windows_.push_back(std::move(child));
+ return child_windows_.back().get();
+}
+
WebState* TestWebStateDelegate::OpenURLFromWebState(
WebState* web_state,
const WebState::OpenURLParams& params) {
« no previous file with comments | « ios/web/public/test/fakes/test_web_state_delegate.h ('k') | ios/web/public/web_state/ui/crw_web_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698