Commit 5595454f authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Create WebStateDelegateTabHelper.

This is the first step to moving the WebStateDelegate implementation
out of BVC.  The only pure virtual function on WebStateDelegate is
OnAuthRequired(), so a no-op implementation is added here.

Bug: 986956
Change-Id: I431142cbadcfe4e7cb4a6a9ce77de4ca11d9bb3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1716165Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680617}
parent 5f77ce89
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#import "ios/chrome/browser/web/print_tab_helper.h" #import "ios/chrome/browser/web/print_tab_helper.h"
#import "ios/chrome/browser/web/sad_tab_tab_helper.h" #import "ios/chrome/browser/web/sad_tab_tab_helper.h"
#import "ios/chrome/browser/web/tab_id_tab_helper.h" #import "ios/chrome/browser/web/tab_id_tab_helper.h"
#import "ios/chrome/browser/web/web_state_delegate_tab_helper.h"
#import "ios/public/provider/chrome/browser/chrome_browser_provider.h" #import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state.h"
...@@ -74,6 +75,8 @@ void AttachTabHelpers(web::WebState* web_state, bool for_prerender) { ...@@ -74,6 +75,8 @@ void AttachTabHelpers(web::WebState* web_state, bool for_prerender) {
// so it needs to be created before them. // so it needs to be created before them.
IOSChromeSessionTabHelper::CreateForWebState(web_state); IOSChromeSessionTabHelper::CreateForWebState(web_state);
WebStateDelegateTabHelper::CreateForWebState(web_state);
NSString* tab_id = TabIdTabHelper::FromWebState(web_state)->tab_id(); NSString* tab_id = TabIdTabHelper::FromWebState(web_state)->tab_id();
NetworkActivityIndicatorTabHelper::CreateForWebState(web_state, tab_id); NetworkActivityIndicatorTabHelper::CreateForWebState(web_state, tab_id);
VoiceSearchNavigationTabHelper::CreateForWebState(web_state); VoiceSearchNavigationTabHelper::CreateForWebState(web_state);
......
...@@ -25,6 +25,8 @@ source_set("web") { ...@@ -25,6 +25,8 @@ source_set("web") {
"sad_tab_tab_helper.mm", "sad_tab_tab_helper.mm",
"web_navigation_util.h", "web_navigation_util.h",
"web_navigation_util.mm", "web_navigation_util.mm",
"web_state_delegate_tab_helper.h",
"web_state_delegate_tab_helper.mm",
] ]
deps = [ deps = [
":feature_flags", ":feature_flags",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_WEB_WEB_STATE_DELEGATE_TAB_HELPER_H_
#define IOS_CHROME_BROWSER_WEB_WEB_STATE_DELEGATE_TAB_HELPER_H_
#import "ios/web/public/web_state/web_state_delegate.h"
#include "ios/web/public/web_state/web_state_user_data.h"
// Tab helper that handles the WebStateDelegate implementation.
class WebStateDelegateTabHelper
: public web::WebStateDelegate,
public web::WebStateUserData<WebStateDelegateTabHelper> {
public:
~WebStateDelegateTabHelper() override;
// TODO(crbug.com/986956): Move remaining WebStateDelegate implementations
// into this tab helper.
// web::WebStateDelegate:
void OnAuthRequired(
web::WebState* source,
NSURLProtectionSpace* protection_space,
NSURLCredential* proposed_credential,
const web::WebStateDelegate::AuthCallback& callback) override;
private:
explicit WebStateDelegateTabHelper(web::WebState* web_state);
friend class web::WebStateUserData<WebStateDelegateTabHelper>;
WEB_STATE_USER_DATA_KEY_DECL();
};
#endif // IOS_CHROME_BROWSER_WEB_WEB_STATE_DELEGATE_TAB_HELPER_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/web/web_state_delegate_tab_helper.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
WEB_STATE_USER_DATA_KEY_IMPL(WebStateDelegateTabHelper)
WebStateDelegateTabHelper::WebStateDelegateTabHelper(web::WebState* web_state) {
}
WebStateDelegateTabHelper::~WebStateDelegateTabHelper() = default;
void WebStateDelegateTabHelper::OnAuthRequired(
web::WebState* source,
NSURLProtectionSpace* protection_space,
NSURLCredential* proposed_credential,
const web::WebStateDelegate::AuthCallback& callback) {
AuthCallback local_callback(callback);
local_callback.Run(nil, nil);
// TODO(crbug.com/980101): Show HTTP authentication dialog using
// OverlayPresenter.
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment