Commit 1a8ddf2e authored by sdefresne's avatar sdefresne Committed by Commit bot

Remove obsolete methods from CRWRequestTrackerDelegate protocol.

The methods only had one non-test implementation that was either
returning a constant or not doing anything (besides maybe calling
NOTREACHED).

BUG=585700

Review-Url: https://codereview.chromium.org/2643763005
Cr-Commit-Position: refs/heads/master@{#445025}
parent 505b49d1
......@@ -24,12 +24,6 @@ struct SSLStatus;
// All the methods in this protocol must be sent on the main thread.
@protocol CRWRequestTrackerDelegate
// Returns |YES| of all the requests are static file requests and returns |NO|
// if all the requests are network requests. Note it is not allowed for a
// |CRWRequestTrackerDelegate| to send both static file requests and network
// requests.
- (BOOL)isForStaticFileRequests;
// The tracker calls this method every time there is a change in the SSL status
// of a page. The info is whatever object was passed to TrimToURL().
- (void)updatedSSLStatus:(const web::SSLStatus&)sslStatus
......@@ -40,21 +34,6 @@ struct SSLStatus;
- (void)handleResponseHeaders:(net::HttpResponseHeaders*)headers
requestUrl:(const GURL&)requestUrl;
// This method is called when a network request has an issue with the SSL
// connection to present it to the user. The user will decide if the request
// should continue or not and the callback should be invoked to let the backend
// know.
// If the callback is not called the request will be cancelled on the next call
// to TrimToURL().
// The callback is safe to call until the requestTracker it originated from
// is deleted.
typedef void (^SSLErrorCallback)(BOOL);
- (void)presentSSLError:(const net::SSLInfo&)info
forSSLStatus:(const web::SSLStatus&)status
onUrl:(const GURL&)url
recoverable:(BOOL)recoverable
callback:(SSLErrorCallback)shouldContinue;
// Update the progress.
- (void)updatedProgress:(float)progress;
......
......@@ -162,9 +162,6 @@ class RequestTrackerImpl
static RequestTrackerImpl* GetTrackerForRequestGroupID(
NSString* request_group_id);
// Callback from the UI to allow or deny a particular certificate.
void ErrorCallback(CRWSSLCarrier* carrier, bool allow);
// Utility method for clients to post tasks to the IO thread from the UI
// thread.
void PostIOTask(const base::Closure& task);
......@@ -305,10 +302,6 @@ class RequestTrackerImpl
// Notifies the delegate of an SSL status update.
void NotifyUpdatedSSLStatus(base::scoped_nsobject<CRWSSLCarrier> carrier);
// Calls the delegate method to present an SSL error interstitial.
void NotifyPresentSSLError(base::scoped_nsobject<CRWSSLCarrier> carrier,
bool recoverable);
#pragma mark Internal utilities for task posting
// Posts |task| to |thread|. Must not be called from |thread|. If |thread| is
// the IO thread, silently returns if |is_closing_| is true.
......@@ -345,8 +338,6 @@ class RequestTrackerImpl
unsigned int estimate_start_index_;
// How many notifications are currently queued, to avoid notifying too often.
int notification_depth_;
// The tracker containing the error currently presented to the user.
TrackerCounts* current_ssl_error_;
// Set to |YES| if the page has mixed content
bool has_mixed_content_;
// Set to true if between TrimToURL and StopPageLoad.
......@@ -357,11 +348,6 @@ class RequestTrackerImpl
#pragma mark Other fields.
scoped_refptr<web::CertificatePolicyCache> policy_cache_;
// If |true| all the requests should be static file requests, otherwise all
// the requests should be network requests. This is a constant initialized
// in the constructor and read in IO and UI threads.
const bool is_for_static_file_requests_;
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
// Current page URL, as far as we know.
GURL page_url_;
......
......@@ -222,8 +222,6 @@ struct TrackerCounts {
- (const web::SSLStatus&)sslStatus;
// Returns a SSLInfo with a reference to the certificate and SSL information.
- (const net::SSLInfo&)sslInfo;
// Callback method to allow or deny the request from going through.
- (void)errorCallback:(BOOL)flag;
// Internal method used to build the SSLStatus object. Called from the
// initializer to make sure it is invoked on the network thread.
- (void)buildSSLStatus;
......@@ -255,13 +253,6 @@ struct TrackerCounts {
return status_;
}
- (void)errorCallback:(BOOL)flag {
base::scoped_nsobject<CRWSSLCarrier> scoped(self);
web::WebThread::PostTask(web::WebThread::IO, FROM_HERE,
base::Bind(&web::RequestTrackerImpl::ErrorCallback,
tracker_, scoped, flag));
}
- (void)buildSSLStatus {
DCHECK_CURRENTLY_ON(web::WebThread::IO);
if (!sslInfo_.is_valid())
......@@ -475,7 +466,7 @@ net::URLRequestContext* RequestTrackerImpl::GetRequestContext() {
void RequestTrackerImpl::StartRequest(net::URLRequest* request) {
DCHECK_CURRENTLY_ON(web::WebThread::IO);
DCHECK(!counts_by_request_.count(request));
DCHECK_EQ(is_for_static_file_requests_, request->url().SchemeIsFile());
DCHECK(!request->url().SchemeIsFile());
if (new_estimate_round_) {
// Starting a new estimate round. Ignore the previous requests for the
......@@ -619,19 +610,6 @@ void RequestTrackerImpl::OnSSLCertificateError(
}
}
void RequestTrackerImpl::ErrorCallback(CRWSSLCarrier* carrier, bool allow) {
DCHECK_CURRENTLY_ON(web::WebThread::IO);
DCHECK(policy_cache_);
if (allow) {
policy_cache_->AllowCertForHost([carrier sslInfo].cert.get(),
[carrier url].host(),
[carrier sslInfo].cert_status);
ReevaluateCallbacksForAllCounts();
}
current_ssl_error_ = NULL;
}
#pragma mark Client utility methods.
void RequestTrackerImpl::PostUITaskIfOpen(const base::Closure& task) {
......@@ -668,11 +646,9 @@ RequestTrackerImpl::RequestTrackerImpl(
previous_estimate_(0.0f), // Not active by default.
estimate_start_index_(0),
notification_depth_(0),
current_ssl_error_(NULL),
has_mixed_content_(false),
is_loading_(false),
new_estimate_round_(true),
is_for_static_file_requests_([delegate isForStaticFileRequests]),
request_context_getter_(context_getter),
identifier_(++g_next_request_tracker_id),
request_group_id_([request_group_id copy]),
......@@ -828,19 +804,6 @@ void RequestTrackerImpl::NotifyUpdatedSSLStatus(
userInfo:user_info_];
}
void RequestTrackerImpl::NotifyPresentSSLError(
base::scoped_nsobject<CRWSSLCarrier> carrier,
bool recoverable) {
DCHECK_CURRENTLY_ON(web::WebThread::UI);
[delegate_ presentSSLError:[carrier sslInfo]
forSSLStatus:[carrier sslStatus]
onUrl:[carrier url]
recoverable:recoverable
callback:^(BOOL flag) {
[carrier errorCallback:flag && recoverable];
}];
}
void RequestTrackerImpl::EvaluateSSLCallbackForCounts(TrackerCounts* counts) {
DCHECK_CURRENTLY_ON(web::WebThread::IO);
DCHECK(policy_cache_);
......@@ -921,28 +884,6 @@ void RequestTrackerImpl::ReevaluateCallbacksForAllCounts() {
// Check if the value hasn't changed via a user action.
if (tracker_count->ssl_judgment == CertPolicy::UNKNOWN)
EvaluateSSLCallbackForCounts(tracker_count.get());
CertPolicy::Judgment judgment = tracker_count->ssl_judgment;
if (judgment == CertPolicy::ALLOWED)
continue;
// SSL errors on subrequests are simply ignored. The call to
// EvaluateSSLCallbackForCounts() cancelled the request and nothing will
// restart it.
if (tracker_count->is_subrequest)
continue;
if (!current_ssl_error_) {
// For the UNKNOWN and DENIED state the information should be pushed to
// the delegate. But only one at a time.
current_ssl_error_ = tracker_count.get();
base::scoped_nsobject<CRWSSLCarrier> carrier([[CRWSSLCarrier alloc]
initWithTracker:this counts:current_ssl_error_]);
web::WebThread::PostTask(
web::WebThread::UI, FROM_HERE,
base::Bind(&RequestTrackerImpl::NotifyPresentSSLError, this, carrier,
judgment == CertPolicy::UNKNOWN));
}
}
}
......
......@@ -62,10 +62,6 @@
return self;
}
- (BOOL)isForStaticFileRequests {
return NO;
}
- (void)updatedProgress:(float)progress {
if (progress > 0.0f) {
if (progress < value_) {
......@@ -101,14 +97,6 @@
// Nothing. yet.
}
- (void)presentSSLError:(const net::SSLInfo&)info
forSSLStatus:(const web::SSLStatus&)status
onUrl:(const GURL&)url
recoverable:(BOOL)recoverable
callback:(SSLErrorCallback)shouldContinue {
// Nothing, yet.
}
- (void)certificateUsed:(net::X509Certificate*)certificate
forHost:(const std::string&)host
status:(net::CertStatus)status {
......
......@@ -3500,10 +3500,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
#pragma mark -
#pragma mark CRWRequestTrackerDelegate
- (BOOL)isForStaticFileRequests {
return NO;
}
- (void)updatedSSLStatus:(const web::SSLStatus&)sslStatus
forPageUrl:(const GURL&)url
userInfo:(id)userInfo {
......@@ -3539,15 +3535,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
_webStateImpl->OnHttpResponseHeadersReceived(headers, requestUrl);
}
- (void)presentSSLError:(const net::SSLInfo&)info
forSSLStatus:(const web::SSLStatus&)status
onUrl:(const GURL&)url
recoverable:(BOOL)recoverable
callback:(SSLErrorCallback)shouldContinue {
// This is a UIWebView callback, which is no longer called.
NOTREACHED();
}
- (void)updatedProgress:(float)progress {
// This is a UIWebView callback, which is no longer called.
NOTREACHED();
......
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