From 8a58f9a5e0b7e62d38ceef9c6a3b691a8593e7d9 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Tue, 18 May 2010 18:38:09 +0000 Subject: Remove the mostly-unused FilterPolicy class. Convert the only actually-used bit, FILTER_EXTENSION_MESSAGES, into a bool that's only passed to places that really need it. Also renames ExtensionMessageFilterPeer to ExtensionLocalizationPeer in hopes of making its one use more apparent. I added a couple comments too. BUG=none TEST=none Review URL: http://codereview.chromium.org/2105006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47533 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/ssl/ssl_error_handler.cc | 44 +++------------------------------ chrome/browser/ssl/ssl_error_handler.h | 19 +++----------- chrome/browser/ssl/ssl_manager.cc | 6 ++--- chrome/browser/ssl/ssl_policy.h | 1 - chrome/browser/ssl/ssl_request_info.h | 7 +----- 5 files changed, 9 insertions(+), 68 deletions(-) (limited to 'chrome/browser/ssl') diff --git a/chrome/browser/ssl/ssl_error_handler.cc b/chrome/browser/ssl/ssl_error_handler.cc index 09594ac..e77ab15 100644 --- a/chrome/browser/ssl/ssl_error_handler.cc +++ b/chrome/browser/ssl/ssl_error_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -41,8 +41,8 @@ SSLErrorHandler::SSLErrorHandler(ResourceDispatcherHost* rdh, // This makes sure we don't disappear on the IO thread until we've given an // answer to the URLRequest. // - // Release in CompleteCancelRequest, CompleteContinueRequest, - // CompleteStartRequest or CompleteTakeNoAction. + // Release in CompleteCancelRequest, CompleteContinueRequest, or + // CompleteTakeNoAction. AddRef(); } @@ -97,16 +97,6 @@ void SSLErrorHandler::ContinueRequest() { NewRunnableMethod(this, &SSLErrorHandler::CompleteContinueRequest)); } -void SSLErrorHandler::StartRequest(FilterPolicy::Type filter_policy) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); - - // We need to complete this task on the IO thread. - ChromeThread::PostTask( - ChromeThread::IO, FROM_HERE, - NewRunnableMethod( - this, &SSLErrorHandler::CompleteStartRequest, filter_policy)); -} - void SSLErrorHandler::TakeNoAction() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); @@ -166,34 +156,6 @@ void SSLErrorHandler::CompleteContinueRequest() { Release(); } -void SSLErrorHandler::CompleteStartRequest(FilterPolicy::Type filter_policy) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); - - // It is important that we notify the URLRequest only once. If we try to - // notify the request twice, it may no longer exist and |this| might have - // already have been deleted. - DCHECK(!request_has_been_notified_); - if (request_has_been_notified_) - return; - - URLRequest* request = resource_dispatcher_host_->GetURLRequest(request_id_); - if (request) { - // The request can be NULL if it was cancelled by the renderer (as the - // result of the user navigating to a new page from the location bar). - DLOG(INFO) << "CompleteStartRequest() url: " << request->url().spec(); - // The request should not have been started (SUCCESS is the initial state). - DCHECK(request->status().status() == URLRequestStatus::SUCCESS); - ResourceDispatcherHostRequestInfo* info = - ResourceDispatcherHost::InfoForRequest(request); - info->set_filter_policy(filter_policy); - request->Start(); - } - request_has_been_notified_ = true; - - // We're done with this object on the IO thread. - Release(); -} - void SSLErrorHandler::CompleteTakeNoAction() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); diff --git a/chrome/browser/ssl/ssl_error_handler.h b/chrome/browser/ssl/ssl_error_handler.h index 2589f5d..5fcc4f4 100644 --- a/chrome/browser/ssl/ssl_error_handler.h +++ b/chrome/browser/ssl/ssl_error_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -11,7 +11,6 @@ #include "base/ref_counted.h" #include "chrome/browser/renderer_host/global_request_id.h" #include "chrome/browser/ssl/ssl_manager.h" -#include "chrome/common/filter_policy.h" #include "googleurl/src/gurl.h" #include "webkit/glue/resource_type.h" @@ -25,8 +24,8 @@ class URLRequest; // UI thread. Subclasses should override the OnDispatched/OnDispatchFailed // methods to implement the actions that should be taken on the UI thread. // These methods can call the different convenience methods ContinueRequest/ -// CancelRequest/StartRequest to perform any required action on the URLRequest -// the ErrorHandler was created with. +// CancelRequest to perform any required action on the URLRequest the +// ErrorHandler was created with. // // IMPORTANT NOTE: // @@ -77,14 +76,6 @@ class SSLErrorHandler : public base::RefCountedThreadSafe { // This method can be called from OnDispatchFailed and OnDispatched. void DenyRequest(); - // Starts the associated URLRequest. |filter_policy| specifies whether the - // ResourceDispatcher should attempt to filter the loaded content in order - // to make it secure (ex: images are made slightly transparent and are - // stamped). - // Should only be called when the URLRequest has not already been started. - // This method can be called from OnDispatchFailed and OnDispatched. - void StartRequest(FilterPolicy::Type filter_policy); - // Does nothing on the URLRequest but ensures the current instance ref // count is decremented appropriately. Subclasses that do not want to // take any specific actions in their OnDispatched/OnDispatchFailed should @@ -129,10 +120,6 @@ class SSLErrorHandler : public base::RefCountedThreadSafe { // Call on the IO thread. void CompleteContinueRequest(); - // Completes the StartRequest operation on the IO thread. - // Call on the IO thread. - void CompleteStartRequest(FilterPolicy::Type filter_policy); - // Derefs this instance. // Call on the IO thread. void CompleteTakeNoAction(); diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index 333d8b2..dbff09e 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -202,14 +202,13 @@ void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) { // Simulate loading this resource through the usual path. // Note that we specify SUB_RESOURCE as the resource type as WebCore only // caches sub-resources. - // This resource must have been loaded with FilterPolicy::DONT_FILTER because - // filtered resouces aren't cachable. + // This resource must have been loaded with no filtering because filtered + // resouces aren't cachable. scoped_refptr info = new SSLRequestInfo( details->url(), ResourceType::SUB_RESOURCE, details->frame_origin(), details->main_frame_origin(), - FilterPolicy::DONT_FILTER, details->pid(), details->ssl_cert_id(), details->ssl_cert_status()); @@ -238,7 +237,6 @@ void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) { details->resource_type(), details->frame_origin(), details->main_frame_origin(), - details->filter_policy(), details->origin_child_id(), details->ssl_cert_id(), details->ssl_cert_status()); diff --git a/chrome/browser/ssl/ssl_policy.h b/chrome/browser/ssl/ssl_policy.h index 8c8a5f8..1f1766b 100644 --- a/chrome/browser/ssl/ssl_policy.h +++ b/chrome/browser/ssl/ssl_policy.h @@ -8,7 +8,6 @@ #include #include "chrome/browser/ssl/ssl_blocking_page.h" -#include "chrome/common/filter_policy.h" #include "webkit/glue/resource_type.h" class NavigationEntry; diff --git a/chrome/browser/ssl/ssl_request_info.h b/chrome/browser/ssl/ssl_request_info.h index 8964490..c495cd2 100644 --- a/chrome/browser/ssl/ssl_request_info.h +++ b/chrome/browser/ssl/ssl_request_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -7,7 +7,6 @@ #include -#include "chrome/common/filter_policy.h" #include "googleurl/src/gurl.h" #include "webkit/glue/resource_type.h" @@ -20,7 +19,6 @@ class SSLRequestInfo : public base::RefCounted { ResourceType::Type resource_type, const std::string& frame_origin, const std::string& main_frame_origin, - FilterPolicy::Type filter_policy, int child_id, int ssl_cert_id, int ssl_cert_status) @@ -28,7 +26,6 @@ class SSLRequestInfo : public base::RefCounted { resource_type_(resource_type), frame_origin_(frame_origin), main_frame_origin_(main_frame_origin), - filter_policy_(filter_policy), child_id_(child_id), ssl_cert_id_(ssl_cert_id), ssl_cert_status_(ssl_cert_status) { @@ -38,7 +35,6 @@ class SSLRequestInfo : public base::RefCounted { ResourceType::Type resource_type() const { return resource_type_; } const std::string& frame_origin() const { return frame_origin_; } const std::string& main_frame_origin() const { return main_frame_origin_; } - FilterPolicy::Type filter_policy() const { return filter_policy_; } int child_id() const { return child_id_; } int ssl_cert_id() const { return ssl_cert_id_; } int ssl_cert_status() const { return ssl_cert_status_; } @@ -52,7 +48,6 @@ class SSLRequestInfo : public base::RefCounted { ResourceType::Type resource_type_; std::string frame_origin_; std::string main_frame_origin_; - FilterPolicy::Type filter_policy_; int child_id_; int ssl_cert_id_; int ssl_cert_status_; -- cgit v1.1