summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.cc160
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.h65
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc77
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc17
-rw-r--r--chrome/browser/net/chrome_url_request_context.h5
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc33
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.h5
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc40
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.h5
-rw-r--r--chrome/browser/profiles/profile_io_data.cc27
-rw-r--r--chrome/browser/profiles/profile_io_data.h19
-rw-r--r--chrome/browser/ui/sync/one_click_signin_helper_unittest.cc5
12 files changed, 293 insertions, 165 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index bab8c44..b76bad6 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -9,8 +9,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -19,13 +17,9 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/custom_handlers/protocol_handler.h"
#include "chrome/common/pref_names.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
-#include "content/public/browser/notification_service.h"
#include "grit/generated_resources.h"
#include "net/base/network_delegate.h"
-#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_redirect_job.h"
#include "ui/base/l10n/l10n_util.h"
@@ -63,18 +57,19 @@ bool ShouldRemoveHandlersNotInOS() {
} // namespace
-// Core ------------------------------------------------------------------------
+// IOThreadDelegate ------------------------------------------------------------
-// Core is an IO thread specific object. Access to the class should all
-// be done via the IO thread. The registry living on the UI thread makes
+// IOThreadDelegate is an IO thread specific object. Access to the class should
+// all be done via the IO thread. The registry living on the UI thread makes
// a best effort to update the IO object after local updates are completed.
-class ProtocolHandlerRegistry::Core
- : public base::RefCountedThreadSafe<ProtocolHandlerRegistry::Core> {
+class ProtocolHandlerRegistry::IOThreadDelegate
+ : public base::RefCountedThreadSafe<
+ ProtocolHandlerRegistry::IOThreadDelegate> {
public:
// Creates a new instance. If |enabled| is true the registry is considered
// enabled on the IO thread.
- explicit Core(bool enabled);
+ explicit IOThreadDelegate(bool enabled);
// Returns true if the protocol has a default protocol handler.
// Should be called only from the IO thread.
@@ -102,8 +97,8 @@ class ProtocolHandlerRegistry::Core
void Disable() { enabled_ = false; }
private:
- friend class base::RefCountedThreadSafe<Core>;
- virtual ~Core();
+ friend class base::RefCountedThreadSafe<IOThreadDelegate>;
+ virtual ~IOThreadDelegate();
// Copy of protocol handlers use only on the IO thread.
ProtocolHandlerRegistry::ProtocolHandlerMap default_handlers_;
@@ -111,24 +106,27 @@ class ProtocolHandlerRegistry::Core
// Is the registry enabled on the IO thread.
bool enabled_;
- DISALLOW_COPY_AND_ASSIGN(Core);
+ DISALLOW_COPY_AND_ASSIGN(IOThreadDelegate);
};
-ProtocolHandlerRegistry::Core::Core(bool) : enabled_(true) {}
-ProtocolHandlerRegistry::Core::~Core() {}
+ProtocolHandlerRegistry::IOThreadDelegate::IOThreadDelegate(bool)
+ : enabled_(true) {}
+ProtocolHandlerRegistry::IOThreadDelegate::~IOThreadDelegate() {}
-bool ProtocolHandlerRegistry::Core::IsHandledProtocol(
+bool ProtocolHandlerRegistry::IOThreadDelegate::IsHandledProtocol(
const std::string& scheme) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
return enabled_ && !LookupHandler(default_handlers_, scheme).IsEmpty();
}
-void ProtocolHandlerRegistry::Core::ClearDefault(const std::string& scheme) {
+void ProtocolHandlerRegistry::IOThreadDelegate::ClearDefault(
+ const std::string& scheme) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
default_handlers_.erase(scheme);
}
-void ProtocolHandlerRegistry::Core::SetDefault(const ProtocolHandler& handler) {
+void ProtocolHandlerRegistry::IOThreadDelegate::SetDefault(
+ const ProtocolHandler& handler) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ClearDefault(handler.protocol());
default_handlers_.insert(std::make_pair(handler.protocol(), handler));
@@ -137,7 +135,7 @@ void ProtocolHandlerRegistry::Core::SetDefault(const ProtocolHandler& handler) {
// Create a new job for the supplied |URLRequest| if a default handler
// is registered and the associated handler is able to interpret
// the url from |request|.
-net::URLRequestJob* ProtocolHandlerRegistry::Core::MaybeCreateJob(
+net::URLRequestJob* ProtocolHandlerRegistry::IOThreadDelegate::MaybeCreateJob(
net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -155,62 +153,86 @@ net::URLRequestJob* ProtocolHandlerRegistry::Core::MaybeCreateJob(
net::URLRequestRedirectJob::REDIRECT_302_FOUND);
}
-// URLInterceptor ------------------------------------------------------------
+// JobInterceptorFactory -------------------------------------------------------
-// Instances of this class are produced for ownership by the IO
+// Instances of JobInterceptorFactory are produced for ownership by the IO
// thread where it handler URL requests. We should never hold
// any pointers on this class, only produce them in response to
-// requests via |ProtocolHandlerRegistry::CreateURLInterceptor|.
-class ProtocolHandlerRegistry::URLInterceptor
- : public net::URLRequestJobFactory::Interceptor {
- public:
- explicit URLInterceptor(Core* core);
- virtual ~URLInterceptor();
+// requests via |ProtocolHandlerRegistry::CreateJobInterceptorFactory|.
+ProtocolHandlerRegistry::JobInterceptorFactory::JobInterceptorFactory(
+ IOThreadDelegate* io_thread_delegate)
+ : io_thread_delegate_(io_thread_delegate) {
+ DCHECK(io_thread_delegate_);
+ DetachFromThread();
+}
- virtual net::URLRequestJob* MaybeIntercept(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const OVERRIDE;
+ProtocolHandlerRegistry::JobInterceptorFactory::~JobInterceptorFactory() {
+}
- virtual bool WillHandleProtocol(const std::string& protocol) const OVERRIDE;
+void ProtocolHandlerRegistry::JobInterceptorFactory::Chain(
+ scoped_ptr<net::URLRequestJobFactory> job_factory) {
+ job_factory_ = job_factory.Pass();
+}
- virtual net::URLRequestJob* MaybeInterceptRedirect(
- const GURL& url,
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const OVERRIDE {
- return NULL;
- }
+bool ProtocolHandlerRegistry::JobInterceptorFactory::SetProtocolHandler(
+ const std::string& scheme, ProtocolHandler* protocol_handler) {
+ return job_factory_->SetProtocolHandler(scheme, protocol_handler);
+}
- virtual net::URLRequestJob* MaybeInterceptResponse(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const OVERRIDE {
- return NULL;
- }
+void ProtocolHandlerRegistry::JobInterceptorFactory::AddInterceptor(
+ Interceptor* interceptor) {
+ return job_factory_->AddInterceptor(interceptor);
+}
- private:
- scoped_refptr<Core> core_;
- DISALLOW_COPY_AND_ASSIGN(URLInterceptor);
-};
+net::URLRequestJob*
+ProtocolHandlerRegistry::JobInterceptorFactory::MaybeCreateJobWithInterceptor(
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
+ return job_factory_->MaybeCreateJobWithInterceptor(request, network_delegate);
+}
-ProtocolHandlerRegistry::URLInterceptor::URLInterceptor(Core* core)
- : core_(core) {
- DCHECK(core_);
+net::URLRequestJob*
+ProtocolHandlerRegistry::JobInterceptorFactory::
+MaybeCreateJobWithProtocolHandler(
+ const std::string& scheme,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ net::URLRequestJob* job = io_thread_delegate_->MaybeCreateJob(
+ request, network_delegate);
+ if (job)
+ return job;
+ return job_factory_->MaybeCreateJobWithProtocolHandler(
+ scheme, request, network_delegate);
}
-ProtocolHandlerRegistry::URLInterceptor::~URLInterceptor() {
+net::URLRequestJob*
+ProtocolHandlerRegistry::JobInterceptorFactory::MaybeInterceptRedirect(
+ const GURL& location,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
+ return job_factory_->MaybeInterceptRedirect(
+ location, request, network_delegate);
}
-net::URLRequestJob* ProtocolHandlerRegistry::URLInterceptor::MaybeIntercept(
+net::URLRequestJob*
+ProtocolHandlerRegistry::JobInterceptorFactory::MaybeInterceptResponse(
net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- return core_->MaybeCreateJob(request, network_delegate);
+ return job_factory_->MaybeInterceptResponse(request, network_delegate);
}
-bool ProtocolHandlerRegistry::URLInterceptor::WillHandleProtocol(
- const std::string& protocol) const {
+bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledProtocol(
+ const std::string& scheme) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ return io_thread_delegate_->IsHandledProtocol(scheme) ||
+ job_factory_->IsHandledProtocol(scheme);
+}
- return core_->IsHandledProtocol(protocol);
+bool ProtocolHandlerRegistry::JobInterceptorFactory::IsHandledURL(
+ const GURL& url) const {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ return (url.is_valid() &&
+ io_thread_delegate_->IsHandledProtocol(url.scheme())) ||
+ job_factory_->IsHandledURL(url);
}
// DefaultClientObserver ------------------------------------------------------
@@ -317,7 +339,7 @@ ProtocolHandlerRegistry::ProtocolHandlerRegistry(Profile* profile,
enabled_(true),
is_loading_(false),
is_loaded_(false),
- core_(new Core(enabled_)){
+ io_thread_delegate_(new IOThreadDelegate(enabled_)){
}
bool ProtocolHandlerRegistry::SilentlyHandleRegisterHandlerRequest(
@@ -402,7 +424,7 @@ void ProtocolHandlerRegistry::ClearDefault(const std::string& scheme) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&Core::ClearDefault, core_, scheme));
+ base::Bind(&IOThreadDelegate::ClearDefault, io_thread_delegate_, scheme));
Save();
NotifyChanged();
}
@@ -630,7 +652,8 @@ void ProtocolHandlerRegistry::RemoveHandler(
} else {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&Core::ClearDefault, core_, q->second.protocol()));
+ base::Bind(&IOThreadDelegate::ClearDefault, io_thread_delegate_,
+ q->second.protocol()));
default_handlers_.erase(q);
}
@@ -665,7 +688,7 @@ void ProtocolHandlerRegistry::Enable() {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&Core::Enable, core_));
+ base::Bind(&IOThreadDelegate::Enable, io_thread_delegate_));
ProtocolHandlerMap::const_iterator p;
for (p = default_handlers_.begin(); p != default_handlers_.end(); ++p) {
@@ -684,7 +707,7 @@ void ProtocolHandlerRegistry::Disable() {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&Core::Disable, core_));
+ base::Bind(&IOThreadDelegate::Disable, io_thread_delegate_));
ProtocolHandlerMap::const_iterator p;
for (p = default_handlers_.begin(); p != default_handlers_.end(); ++p) {
@@ -773,7 +796,7 @@ void ProtocolHandlerRegistry::SetDefault(const ProtocolHandler& handler) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(&Core::SetDefault, core_, handler));
+ base::Bind(&IOThreadDelegate::SetDefault, io_thread_delegate_, handler));
}
void ProtocolHandlerRegistry::InsertHandler(const ProtocolHandler& handler) {
@@ -875,11 +898,12 @@ void ProtocolHandlerRegistry::AddPredefinedHandler(
SetDefault(handler);
}
-net::URLRequestJobFactory::Interceptor*
- ProtocolHandlerRegistry::CreateURLInterceptor() {
+scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
+ProtocolHandlerRegistry::CreateJobInterceptorFactory() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// this is always created on the UI thread (in profile_io's
// InitializeOnUIThread. Any method calls must be done
// on the IO thread (this is checked).
- return new URLInterceptor(core_);
+ return scoped_ptr<JobInterceptorFactory>(new JobInterceptorFactory(
+ io_thread_delegate_));
}
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h
index e8ae913..e1331c1 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.h
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
@@ -84,6 +85,57 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
ProtocolHandlerRegistry* registry);
};
+ // Forward declaration of the internal implementation class.
+ class IOThreadDelegate;
+
+ // JobInterceptorFactory intercepts URLRequestJob creation for URLRequests the
+ // ProtocolHandlerRegistry is registered to handle. When no handler is
+ // registered, the URLRequest is passed along to the chained
+ // URLRequestJobFactory (set with |JobInterceptorFactory::Chain|).
+ // JobInterceptorFactory's are created via
+ // |ProtocolHandlerRegistry::CreateJobInterceptorFactory|.
+ class JobInterceptorFactory : public net::URLRequestJobFactory {
+ public:
+ // |io_thread_delegate| is used to perform actual job creation work.
+ explicit JobInterceptorFactory(IOThreadDelegate* io_thread_delegate);
+ virtual ~JobInterceptorFactory();
+
+ // |job_factory| is set as the URLRequestJobFactory where requests are
+ // forwarded if JobInterceptorFactory decides to pass on them.
+ void Chain(scoped_ptr<net::URLRequestJobFactory> job_factory);
+
+ // URLRequestJobFactory implementation.
+ virtual bool SetProtocolHandler(const std::string& scheme,
+ ProtocolHandler* protocol_handler) OVERRIDE;
+ virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE;
+ virtual net::URLRequestJob* MaybeCreateJobWithInterceptor(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
+ const std::string& scheme,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual net::URLRequestJob* MaybeInterceptRedirect(
+ const GURL& location,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual net::URLRequestJob* MaybeInterceptResponse(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+ virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE;
+ virtual bool IsHandledURL(const GURL& url) const OVERRIDE;
+
+ private:
+ // When JobInterceptorFactory decides to pass on particular requests,
+ // they're forwarded to the chained URLRequestJobFactory, |job_factory_|.
+ scoped_ptr<URLRequestJobFactory> job_factory_;
+ // |io_thread_delegate_| performs the actual job creation decisions by
+ // mirroring the ProtocolHandlerRegistry on the IO thread.
+ scoped_refptr<IOThreadDelegate> io_thread_delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(JobInterceptorFactory);
+ };
+
typedef std::map<std::string, ProtocolHandler> ProtocolHandlerMap;
typedef std::vector<ProtocolHandler> ProtocolHandlerList;
typedef std::map<std::string, ProtocolHandlerList> ProtocolHandlerMultiMap;
@@ -93,10 +145,9 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
ProtocolHandlerRegistry(Profile* profile, Delegate* delegate);
virtual ~ProtocolHandlerRegistry();
- // Returns a net::URLRequestJobFactory::Interceptor suitable
- // for use on the IO thread, but is initialized on the UI thread.
- // Callers assume responsibility for deleting this object.
- net::URLRequestJobFactory::Interceptor* CreateURLInterceptor();
+ // Returns a net::URLRequestJobFactory suitable for use on the IO thread, but
+ // is initialized on the UI thread.
+ scoped_ptr<JobInterceptorFactory> CreateJobInterceptorFactory();
// Called when a site tries to register as a protocol handler. If the request
// can be handled silently by the registry - either to ignore the request
@@ -212,10 +263,6 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
friend class ProtocolHandlerRegistryTest;
friend class RegisterProtocolHandlerBrowserTest;
- // Forward declaration of the internal implementation classes.
- class Core;
- class URLInterceptor;
-
// Puts the given handler at the top of the list of handlers for its
// protocol.
void PromoteHandler(const ProtocolHandler& handler);
@@ -287,7 +334,7 @@ class ProtocolHandlerRegistry : public ProfileKeyedService {
// Copy of registry data for use on the IO thread. Changes to the registry
// are posted to the IO thread where updates are applied to this object.
- scoped_refptr<Core> core_;
+ scoped_refptr<IOThreadDelegate> io_thread_delegate_;
DefaultClientObserverList default_client_observers_;
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 1561a14..5db5eca 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -30,18 +30,19 @@ namespace {
void AssertInterceptedIO(
const GURL& url,
- net::URLRequestJobFactory::Interceptor* interceptor) {
+ net::URLRequestJobFactory* interceptor) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
net::URLRequestContext context;
net::URLRequest request(url, NULL, &context);
- scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept(
- &request, context.network_delegate());
+ scoped_refptr<net::URLRequestJob> job =
+ interceptor->MaybeCreateJobWithProtocolHandler(
+ url.scheme(), &request, context.network_delegate());
ASSERT_TRUE(job.get() != NULL);
}
void AssertIntercepted(
const GURL& url,
- net::URLRequestJobFactory::Interceptor* interceptor) {
+ net::URLRequestJobFactory* interceptor) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
@@ -51,18 +52,64 @@ void AssertIntercepted(
MessageLoop::current()->RunUntilIdle();
}
+// FakeURLRequestJobFactory returns NULL for all job creation requests and false
+// for all IsHandled*() requests. FakeURLRequestJobFactory can be chained to
+// ProtocolHandlerRegistry::JobInterceptorFactory so the result of
+// MaybeCreateJobWithProtocolHandler() indicates whether the
+// ProtocolHandlerRegistry properly handled a job creation request.
+class FakeURLRequestJobFactory : public net::URLRequestJobFactory {
+ // net::URLRequestJobFactory implementation:
+ virtual bool SetProtocolHandler(const std::string& scheme,
+ ProtocolHandler* protocol_handler) OVERRIDE {
+ return false;
+ }
+ virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE {
+ }
+ virtual net::URLRequestJob* MaybeCreateJobWithInterceptor(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
+ return NULL;
+ }
+ net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
+ const std::string& scheme,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
+ return NULL;
+ }
+ net::URLRequestJob* MaybeInterceptRedirect(
+ const GURL& location,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
+ return NULL;
+ }
+ net::URLRequestJob* MaybeInterceptResponse(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
+ return NULL;
+ }
+ virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE {
+ return false;
+ }
+ virtual bool IsHandledURL(const GURL& url) const OVERRIDE {
+ return false;
+ }
+};
+
void AssertWillHandleIO(
const std::string& scheme,
bool expected,
- net::URLRequestJobFactory::Interceptor* interceptor) {
+ ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ASSERT_EQ(expected, interceptor->WillHandleProtocol(scheme));
+ interceptor->Chain(scoped_ptr<net::URLRequestJobFactory>(
+ new FakeURLRequestJobFactory()));
+ ASSERT_EQ(expected, interceptor->IsHandledProtocol(scheme));
+ interceptor->Chain(scoped_ptr<net::URLRequestJobFactory>(NULL));
}
void AssertWillHandle(
const std::string& scheme,
bool expected,
- net::URLRequestJobFactory::Interceptor* interceptor) {
+ ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
@@ -754,8 +801,8 @@ TEST_F(ProtocolHandlerRegistryTest, TestMaybeCreateTaskWorksFromIOThread) {
registry()->OnAcceptRegisterProtocolHandler(ph1);
GURL url("mailto:someone@something.com");
- scoped_ptr<net::URLRequestJobFactory::Interceptor> interceptor(
- registry()->CreateURLInterceptor());
+ scoped_ptr<net::URLRequestJobFactory> interceptor(
+ registry()->CreateJobInterceptorFactory());
AssertIntercepted(url, interceptor.get());
}
@@ -765,8 +812,8 @@ TEST_F(ProtocolHandlerRegistryTest,
ProtocolHandler ph1 = CreateProtocolHandler(scheme, "test1");
registry()->OnAcceptRegisterProtocolHandler(ph1);
- scoped_ptr<net::URLRequestJobFactory::Interceptor> interceptor(
- registry()->CreateURLInterceptor());
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> interceptor(
+ registry()->CreateJobInterceptorFactory());
AssertWillHandle(scheme, true, interceptor.get());
}
@@ -812,8 +859,8 @@ TEST_F(ProtocolHandlerRegistryTest, MAYBE_TestClearDefaultGetsPropagatedToIO) {
registry()->OnAcceptRegisterProtocolHandler(ph1);
registry()->ClearDefault(scheme);
- scoped_ptr<net::URLRequestJobFactory::Interceptor> interceptor(
- registry()->CreateURLInterceptor());
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> interceptor(
+ registry()->CreateJobInterceptorFactory());
AssertWillHandle(scheme, false, interceptor.get());
}
@@ -822,8 +869,8 @@ TEST_F(ProtocolHandlerRegistryTest, TestLoadEnabledGetsPropogatedToIO) {
ProtocolHandler ph1 = CreateProtocolHandler(mailto, "MailtoHandler");
registry()->OnAcceptRegisterProtocolHandler(ph1);
- scoped_ptr<net::URLRequestJobFactory::Interceptor> interceptor(
- registry()->CreateURLInterceptor());
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> interceptor(
+ registry()->CreateJobInterceptorFactory());
AssertWillHandle(mailto, true, interceptor.get());
registry()->Disable();
AssertWillHandle(mailto, false, interceptor.get());
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 677ed0a..b782583 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -68,11 +68,12 @@ class FactoryForExtensions : public ChromeURLRequestContextFactory {
// Factory that creates the ChromeURLRequestContext for a given isolated app.
class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
public:
- FactoryForIsolatedApp(const ProfileIOData* profile_io_data,
- const StoragePartitionDescriptor& partition_descriptor,
- ChromeURLRequestContextGetter* main_context,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
- protocol_handler_interceptor)
+ FactoryForIsolatedApp(
+ const ProfileIOData* profile_io_data,
+ const StoragePartitionDescriptor& partition_descriptor,
+ ChromeURLRequestContextGetter* main_context,
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
+ protocol_handler_interceptor)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
main_request_context_getter_(main_context),
@@ -94,7 +95,7 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
const StoragePartitionDescriptor partition_descriptor_;
scoped_refptr<ChromeURLRequestContextGetter>
main_request_context_getter_;
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor_;
};
@@ -211,7 +212,7 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
Profile* profile,
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) {
DCHECK(!profile->IsOffTheRecord());
ChromeURLRequestContextGetter* main_context =
@@ -258,7 +259,7 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
Profile* profile,
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) {
DCHECK(profile->IsOffTheRecord());
ChromeURLRequestContextGetter* main_context =
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 93ce806..c5eaaa5 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_job_factory.h"
@@ -132,7 +133,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter {
Profile* profile,
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor);
// Create an instance for an original profile for media with isolated
@@ -159,7 +160,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter {
Profile* profile,
const ProfileIOData* profile_io_data,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor);
private:
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index 37a3f73..615a752 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -119,10 +119,10 @@ OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter(
if (iter != app_request_context_getter_map_.end())
return iter->second;
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor(
ProtocolHandlerRegistryFactory::GetForProfile(profile_)->
- CreateURLInterceptor());
+ CreateJobInterceptorFactory());
ChromeURLRequestContextGetter* context =
ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
profile_, io_data_, descriptor,
@@ -218,13 +218,12 @@ void OffTheRecordProfileIOData::LazyInitializeInternal(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
- SetUpJobFactoryDefaults(
- main_job_factory.get(),
+ main_job_factory_ = SetUpJobFactoryDefaults(
+ main_job_factory.Pass(),
profile_params->protocol_handler_interceptor.Pass(),
network_delegate(),
main_context->ftp_transaction_factory(),
main_context->ftp_auth_cache());
- main_job_factory_ = main_job_factory.Pass();
main_context->set_job_factory(main_job_factory_.get());
#if defined(ENABLE_EXTENSIONS)
@@ -271,13 +270,12 @@ void OffTheRecordProfileIOData::
// job_factory::IsHandledProtocol return true, which prevents attempts to
// handle the protocol externally. We pass NULL in to
// SetUpJobFactoryDefaults() to get this effect.
- SetUpJobFactoryDefaults(
- extensions_job_factory.get(),
- scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL),
+ extensions_job_factory_ = SetUpJobFactoryDefaults(
+ extensions_job_factory.Pass(),
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(NULL),
NULL,
extensions_context->ftp_transaction_factory(),
extensions_context->ftp_auth_cache());
- extensions_job_factory_ = extensions_job_factory.Pass();
extensions_context->set_job_factory(extensions_job_factory_.get());
}
@@ -285,7 +283,7 @@ ChromeURLRequestContext*
OffTheRecordProfileIOData::InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const {
AppRequestContext* context = new AppRequestContext(load_time_stats());
@@ -309,12 +307,13 @@ OffTheRecordProfileIOData::InitializeAppRequestContext(
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
- SetUpJobFactoryDefaults(job_factory.get(),
- protocol_handler_interceptor.Pass(),
- network_delegate(),
- context->ftp_transaction_factory(),
- context->ftp_auth_cache());
- context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>());
+ scoped_ptr<net::URLRequestJobFactory> top_job_factory;
+ top_job_factory = SetUpJobFactoryDefaults(job_factory.Pass(),
+ protocol_handler_interceptor.Pass(),
+ network_delegate(),
+ context->ftp_transaction_factory(),
+ context->ftp_auth_cache());
+ context->SetJobFactory(top_job_factory.Pass());
return context;
}
@@ -336,7 +335,7 @@ ChromeURLRequestContext*
OffTheRecordProfileIOData::AcquireIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const {
// We create per-app contexts on demand, unlike the others above.
ChromeURLRequestContext* app_request_context =
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.h b/chrome/browser/profiles/off_the_record_profile_io_data.h
index b6c81b7..e842951 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.h
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.h
@@ -11,6 +11,7 @@
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/profiles/storage_partition_descriptor.h"
@@ -102,7 +103,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
virtual ChromeURLRequestContext* InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const OVERRIDE;
virtual ChromeURLRequestContext* InitializeMediaRequestContext(
ChromeURLRequestContext* original_context,
@@ -113,7 +114,7 @@ class OffTheRecordProfileIOData : public ProfileIOData {
AcquireIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const OVERRIDE;
virtual ChromeURLRequestContext*
AcquireIsolatedMediaRequestContext(
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index be8c593..b703c5b 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -202,10 +202,10 @@ ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter(
if (iter != app_request_context_getter_map_.end())
return iter->second;
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor(
ProtocolHandlerRegistryFactory::GetForProfile(profile_)->
- CreateURLInterceptor());
+ CreateJobInterceptorFactory());
ChromeURLRequestContextGetter* context =
ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
profile_, io_data_, descriptor,
@@ -423,12 +423,12 @@ void ProfileImplIOData::LazyInitializeInternal(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
- SetUpJobFactoryDefaults(main_job_factory.get(),
- profile_params->protocol_handler_interceptor.Pass(),
- network_delegate(),
- main_context->ftp_transaction_factory(),
- main_context->ftp_auth_cache());
- main_job_factory_ = main_job_factory.Pass();
+ main_job_factory_ = SetUpJobFactoryDefaults(
+ main_job_factory.Pass(),
+ profile_params->protocol_handler_interceptor.Pass(),
+ network_delegate(),
+ main_context->ftp_transaction_factory(),
+ main_context->ftp_auth_cache());
main_context->set_job_factory(main_job_factory_.get());
#if defined(ENABLE_EXTENSIONS)
@@ -482,13 +482,12 @@ void ProfileImplIOData::
// job_factory::IsHandledProtocol return true, which prevents attempts to
// handle the protocol externally. We pass NULL in to
// SetUpJobFactory() to get this effect.
- SetUpJobFactoryDefaults(
- extensions_job_factory.get(),
- scoped_ptr<net::URLRequestJobFactoryImpl::Interceptor>(NULL),
+ extensions_job_factory_ = SetUpJobFactoryDefaults(
+ extensions_job_factory.Pass(),
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(NULL),
NULL,
extensions_context->ftp_transaction_factory(),
extensions_context->ftp_auth_cache());
- extensions_job_factory_ = extensions_job_factory.Pass();
extensions_context->set_job_factory(extensions_job_factory_.get());
}
@@ -496,7 +495,7 @@ ChromeURLRequestContext*
ProfileImplIOData::InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const {
// Copy most state from the main context.
AppRequestContext* context = new AppRequestContext(load_time_stats());
@@ -560,20 +559,23 @@ ProfileImplIOData::InitializeAppRequestContext(
context->SetHttpTransactionFactory(
scoped_ptr<net::HttpTransactionFactory>(app_http_cache));
+ scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
+ new net::URLRequestJobFactoryImpl());
+ scoped_ptr<net::URLRequestJobFactory> top_job_factory;
// Overwrite the job factory that we inherit from the main context so
// that we can later provide our own handlers for storage related protocols.
// Install all the usual protocol handlers unless we are in a browser plugin
// guest process, in which case only web-safe schemes are allowed.
- scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
- new net::URLRequestJobFactoryImpl());
if (!partition_descriptor.in_memory) {
- SetUpJobFactoryDefaults(
- job_factory.get(), protocol_handler_interceptor.Pass(),
+ top_job_factory = SetUpJobFactoryDefaults(
+ job_factory.Pass(), protocol_handler_interceptor.Pass(),
network_delegate(),
context->ftp_transaction_factory(),
context->ftp_auth_cache());
+ } else {
+ top_job_factory = job_factory.PassAs<net::URLRequestJobFactory>();
}
- context->SetJobFactory(job_factory.PassAs<net::URLRequestJobFactory>());
+ context->SetJobFactory(top_job_factory.Pass());
return context;
}
@@ -636,7 +638,7 @@ ChromeURLRequestContext*
ProfileImplIOData::AcquireIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const {
// We create per-app contexts on demand, unlike the others above.
ChromeURLRequestContext* app_request_context =
diff --git a/chrome/browser/profiles/profile_impl_io_data.h b/chrome/browser/profiles/profile_impl_io_data.h
index 0f79bd0..be1411d 100644
--- a/chrome/browser/profiles/profile_impl_io_data.h
+++ b/chrome/browser/profiles/profile_impl_io_data.h
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/profiles/profile_io_data.h"
namespace chrome_browser_net {
@@ -151,7 +152,7 @@ class ProfileImplIOData : public ProfileIOData {
virtual ChromeURLRequestContext* InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const OVERRIDE;
virtual ChromeURLRequestContext* InitializeMediaRequestContext(
ChromeURLRequestContext* original_context,
@@ -162,7 +163,7 @@ class ProfileImplIOData : public ProfileIOData {
AcquireIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const OVERRIDE;
virtual ChromeURLRequestContext*
AcquireIsolatedMediaRequestContext(
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 7d6f2a0..959394b 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -172,10 +172,10 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
DCHECK(protocol_handler_registry);
// The profile instance is only available here in the InitializeOnUIThread
- // method, so we create the url interceptor here, then save it for
+ // method, so we create the url job factory here, then save it for
// later delivery to the job factory in LazyInitialize.
- params->protocol_handler_interceptor.reset(
- protocol_handler_registry->CreateURLInterceptor());
+ params->protocol_handler_interceptor =
+ protocol_handler_registry->CreateJobInterceptorFactory();
ChromeProxyConfigService* proxy_config_service =
ProxyServiceFactory::CreateProxyConfigService(true);
@@ -394,7 +394,7 @@ ChromeURLRequestContext*
ProfileIOData::GetIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const {
LazyInitialize();
ChromeURLRequestContext* context = NULL;
@@ -604,9 +604,9 @@ void ProfileIOData::ApplyProfileParamsToContext(
context->set_ssl_config_service(profile_params_->ssl_config_service);
}
-void ProfileIOData::SetUpJobFactoryDefaults(
- net::URLRequestJobFactoryImpl* job_factory,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults(
+ scoped_ptr<net::URLRequestJobFactoryImpl> job_factory,
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
net::NetworkDelegate* network_delegate,
net::FtpTransactionFactory* ftp_transaction_factory,
@@ -622,11 +622,6 @@ void ProfileIOData::SetUpJobFactoryDefaults(
CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(),
network_delegate));
DCHECK(set_protocol);
-
- if (protocol_handler_interceptor.get()) {
- job_factory->AddInterceptor(protocol_handler_interceptor.release());
- }
-
set_protocol = job_factory->SetProtocolHandler(
extensions::kExtensionScheme,
CreateExtensionProtocolHandler(is_incognito(), GetExtensionInfoMap()));
@@ -661,6 +656,14 @@ void ProfileIOData::SetUpJobFactoryDefaults(
new net::FtpProtocolHandler(ftp_transaction_factory,
ftp_auth_cache));
#endif // !defined(DISABLE_FTP_SUPPORT)
+
+ if (protocol_handler_interceptor) {
+ protocol_handler_interceptor->Chain(
+ job_factory.PassAs<net::URLRequestJobFactory>());
+ return protocol_handler_interceptor.PassAs<net::URLRequestJobFactory>();
+ } else {
+ return job_factory.PassAs<net::URLRequestJobFactory>();
+ }
}
void ProfileIOData::ShutdownOnUIThread() {
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index 948e016..34fdecb 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -15,6 +15,7 @@
#include "base/memory/weak_ptr.h"
#include "base/prefs/public/pref_member.h"
#include "base/synchronization/lock.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/profiles/storage_partition_descriptor.h"
@@ -88,7 +89,7 @@ class ProfileIOData {
ChromeURLRequestContext* GetIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const;
ChromeURLRequestContext* GetIsolatedMediaRequestContext(
ChromeURLRequestContext* app_context,
@@ -218,11 +219,11 @@ class ProfileIOData {
DesktopNotificationService* notification_service;
#endif
- // This pointer exists only as a means of conveying a url interceptor
+ // This pointer exists only as a means of conveying a url job factory
// pointer from the protocol handler registry on the UI thread to the
- // the URLRequestJobFactory on the IO thread. The consumer MUST take
+ // the URLRequestContext on the IO thread. The consumer MUST take
// ownership of the object by calling release() on this pointer.
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor;
// We need to initialize the ProxyConfigService from the UI thread
@@ -242,9 +243,9 @@ class ProfileIOData {
void InitializeOnUIThread(Profile* profile);
void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const;
- void SetUpJobFactoryDefaults(
- net::URLRequestJobFactoryImpl* job_factory,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults(
+ scoped_ptr<net::URLRequestJobFactoryImpl> job_factory,
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
net::NetworkDelegate* network_delegate,
net::FtpTransactionFactory* ftp_transaction_factory,
@@ -352,7 +353,7 @@ class ProfileIOData {
virtual ChromeURLRequestContext* InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& details,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const = 0;
// Does an on-demand initialization of a media RequestContext for the given
@@ -369,7 +370,7 @@ class ProfileIOData {
AcquireIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const = 0;
virtual ChromeURLRequestContext*
AcquireIsolatedMediaRequestContext(
diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
index 2894025..406d3d0 100644
--- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
+++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/content_settings/cookie_settings.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
@@ -93,7 +94,7 @@ class TestProfileIOData : public ProfileIOData {
virtual ChromeURLRequestContext* InitializeAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& details,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const OVERRIDE {
NOTREACHED();
return NULL;
@@ -113,7 +114,7 @@ class TestProfileIOData : public ProfileIOData {
AcquireIsolatedAppRequestContext(
ChromeURLRequestContext* main_context,
const StoragePartitionDescriptor& partition_descriptor,
- scoped_ptr<net::URLRequestJobFactory::Interceptor>
+ scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor) const OVERRIDE {
NOTREACHED();
return NULL;