Skip to content
Snippets Groups Projects
Commit 6981d963 authored by tfarina@chromium.org's avatar tfarina@chromium.org
Browse files

net: Remove typedef net::URLRequest URLRequest;

BUG=64263
TEST=compiled locally, trybots

Review URL: http://codereview.chromium.org/5384002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67762 0039d316-1c4b-4281-b951-d872f2087c98
parent d4e04a67
No related merge requests found
Showing
with 127 additions and 117 deletions
......@@ -24,8 +24,8 @@
// before destroying that thread, one can check that there are no remaining
// instances of that class.
//
// For example, to enable leak tracking for class URLRequest, start by
// adding a member variable of type LeakTracker<URLRequest>.
// For example, to enable leak tracking for class net::URLRequest, start by
// adding a member variable of type LeakTracker<net::URLRequest>.
//
// class URLRequest {
// ...
......@@ -34,11 +34,11 @@
// };
//
//
// Next, when we believe all instances of URLRequest have been deleted:
// Next, when we believe all instances of net::URLRequest have been deleted:
//
// LeakTracker<URLRequest>::CheckForLeaks();
// LeakTracker<net::URLRequest>::CheckForLeaks();
//
// Should the check fail (because there are live instances of URLRequest),
// Should the check fail (because there are live instances of net::URLRequest),
// then the allocation callstack for each leaked instances is dumped to
// the error log.
//
......
......@@ -19,11 +19,10 @@ bool ViewAppCacheInternalsJobFactory::IsSupportedURL(const GURL& url) {
// static.
URLRequestJob* ViewAppCacheInternalsJobFactory::CreateJobForRequest(
URLRequest* request) {
net::URLRequest* request) {
URLRequestContext* context = request->context();
ChromeURLRequestContext* chrome_request_context =
reinterpret_cast<ChromeURLRequestContext*>(context);
return new appcache::ViewAppCacheInternalsJob(
request, chrome_request_context->appcache_service());
}
......@@ -148,13 +148,13 @@ AutocompleteInput::Type AutocompleteInput::Parse(
if (parts->scheme.is_nonempty() &&
(parsed_scheme != L"http") && (parsed_scheme != L"https")) {
// See if we know how to handle the URL internally.
if (URLRequest::IsHandledProtocol(WideToASCII(parsed_scheme)))
if (net::URLRequest::IsHandledProtocol(WideToASCII(parsed_scheme)))
return URL;
// There are also some schemes that we convert to other things before they
// reach the renderer or else the renderer handles internally without
// reaching the URLRequest logic. We thus won't catch these above, but we
// should still claim to handle them.
// reaching the net::URLRequest logic. We thus won't catch these above, but
// we should still claim to handle them.
if (LowerCaseEqualsASCII(parsed_scheme, chrome::kViewSourceScheme) ||
LowerCaseEqualsASCII(parsed_scheme, chrome::kJavaScriptScheme) ||
LowerCaseEqualsASCII(parsed_scheme, chrome::kDataScheme))
......
......@@ -39,13 +39,17 @@ static const char* const kFilteredHeaderStrings[] = {
int URLRequestAutomationJob::instance_count_ = 0;
bool URLRequestAutomationJob::is_protocol_factory_registered_ = false;
URLRequest::ProtocolFactory* URLRequestAutomationJob::old_http_factory_
net::URLRequest::ProtocolFactory* URLRequestAutomationJob::old_http_factory_
= NULL;
URLRequest::ProtocolFactory* URLRequestAutomationJob::old_https_factory_
net::URLRequest::ProtocolFactory* URLRequestAutomationJob::old_https_factory_
= NULL;
URLRequestAutomationJob::URLRequestAutomationJob(URLRequest* request, int tab,
int request_id, AutomationResourceMessageFilter* filter, bool is_pending)
URLRequestAutomationJob::URLRequestAutomationJob(
net::URLRequest* request,
int tab,
int request_id,
AutomationResourceMessageFilter* filter,
bool is_pending)
: URLRequestJob(request),
id_(0),
tab_(tab),
......@@ -73,18 +77,18 @@ bool URLRequestAutomationJob::EnsureProtocolFactoryRegistered() {
if (!is_protocol_factory_registered_) {
old_http_factory_ =
URLRequest::RegisterProtocolFactory("http",
&URLRequestAutomationJob::Factory);
net::URLRequest::RegisterProtocolFactory(
"http", &URLRequestAutomationJob::Factory);
old_https_factory_ =
URLRequest::RegisterProtocolFactory("https",
&URLRequestAutomationJob::Factory);
net::URLRequest::RegisterProtocolFactory(
"https", &URLRequestAutomationJob::Factory);
is_protocol_factory_registered_ = true;
}
return true;
}
URLRequestJob* URLRequestAutomationJob::Factory(URLRequest* request,
URLRequestJob* URLRequestAutomationJob::Factory(net::URLRequest* request,
const std::string& scheme) {
bool scheme_is_http = request->url().SchemeIs("http");
bool scheme_is_https = request->url().SchemeIs("https");
......
......@@ -27,14 +27,14 @@ struct AutomationURLResponse;
// automation.
class URLRequestAutomationJob : public net::URLRequestJob {
public:
URLRequestAutomationJob(URLRequest* request, int tab, int request_id,
URLRequestAutomationJob(net::URLRequest* request, int tab, int request_id,
AutomationResourceMessageFilter* filter,
bool is_pending);
// Register our factory for HTTP/HTTPs requests.
static bool EnsureProtocolFactoryRegistered();
static URLRequest::ProtocolFactory Factory;
static net::URLRequest::ProtocolFactory Factory;
// URLRequestJob methods.
virtual void Start();
......@@ -110,8 +110,8 @@ class URLRequestAutomationJob : public net::URLRequestJob {
static bool is_protocol_factory_registered_;
// The previous HTTP/HTTPs protocol factories. We pass unhandled
// requests off to these factories
static URLRequest::ProtocolFactory* old_http_factory_;
static URLRequest::ProtocolFactory* old_https_factory_;
static net::URLRequest::ProtocolFactory* old_http_factory_;
static net::URLRequest::ProtocolFactory* old_https_factory_;
// Set to true if the job is waiting for the external host to connect to the
// automation channel, which will be used for routing the network requests to
......
......@@ -1076,8 +1076,8 @@ int BrowserMain(const MainFunctionParams& parameters) {
if (parsed_command_line.HasSwitch(switches::kImport) ||
parsed_command_line.HasSwitch(switches::kImportFromFile)) {
// We use different BrowserProcess when importing so no GoogleURLTracker is
// instantiated (as it makes a URLRequest and we don't have an IO thread,
// see bug #1292702).
// instantiated (as it makes a net::URLRequest and we don't have an IO
// thread, see bug #1292702).
browser_process.reset(new FirstRunBrowserProcess(parsed_command_line));
is_first_run = false;
} else {
......@@ -1321,7 +1321,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
// Allow access to file:// on ChromeOS for tests.
if (parsed_command_line.HasSwitch(switches::kAllowFileAccess)) {
URLRequest::AllowFileAccess();
net::URLRequest::AllowFileAccess();
}
// There are two use cases for kLoginUser:
......
......@@ -350,7 +350,7 @@ bool ChildProcessSecurityPolicy::CanRequestURL(
return false;
}
if (!URLRequest::IsHandledURL(url))
if (!net::URLRequest::IsHandledURL(url))
return true; // This URL request is destined for ShellExecute.
{
......
......@@ -18,11 +18,11 @@ class ChildProcessSecurityPolicyTest : public testing::Test {
// testing::Test
virtual void SetUp() {
// In the real world, "chrome:" is a handled scheme.
URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme,
&URLRequestTestJob::Factory);
net::URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme,
&URLRequestTestJob::Factory);
}
virtual void TearDown() {
URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme, NULL);
net::URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme, NULL);
}
};
......@@ -133,7 +133,7 @@ TEST_F(ChildProcessSecurityPolicyTest, RegisterWebSafeSchemeTest) {
EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("asdf:rockers")));
// Once we register a ProtocolFactory for "asdf", we default to deny.
URLRequest::RegisterProtocolFactory("asdf", &URLRequestTestJob::Factory);
net::URLRequest::RegisterProtocolFactory("asdf", &URLRequestTestJob::Factory);
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("asdf:rockers")));
// We can allow new schemes by adding them to the whitelist.
......@@ -141,7 +141,7 @@ TEST_F(ChildProcessSecurityPolicyTest, RegisterWebSafeSchemeTest) {
EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("asdf:rockers")));
// Cleanup.
URLRequest::RegisterProtocolFactory("asdf", NULL);
net::URLRequest::RegisterProtocolFactory("asdf", NULL);
EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("asdf:rockers")));
p->Remove(kRendererID);
......
......@@ -54,10 +54,10 @@ using base::TimeDelta;
// intercept the request.
// NOTE: All methods must be called on the IO thread.
class PluginRequestInterceptor
: public PluginHelper, public URLRequest::Interceptor {
: public PluginHelper, public net::URLRequest::Interceptor {
public:
static URLRequestJob* UninterceptedProtocolHandler(
URLRequest* request, const std::string& scheme) {
net::URLRequest* request, const std::string& scheme) {
// This will get called if a plugin failed to intercept a request for a
// protocol it has registered. In that case, we return NULL and the request
// will result in an error.
......@@ -66,17 +66,17 @@ class PluginRequestInterceptor
explicit PluginRequestInterceptor(ChromePluginLib* plugin)
: PluginHelper(plugin) {
URLRequest::RegisterRequestInterceptor(this);
net::URLRequest::RegisterRequestInterceptor(this);
}
virtual ~PluginRequestInterceptor() {
URLRequest::UnregisterRequestInterceptor(this);
net::URLRequest::UnregisterRequestInterceptor(this);
// Unregister our protocols.
for (HandledProtocolList::iterator it = registered_protocols_.begin();
it != registered_protocols_.end(); ++it) {
URLRequest::ProtocolFactory* factory =
URLRequest::RegisterProtocolFactory(*it, NULL);
net::URLRequest::ProtocolFactory* factory =
net::URLRequest::RegisterProtocolFactory(*it, NULL);
DCHECK(factory == UninterceptedProtocolHandler);
}
}
......@@ -87,17 +87,17 @@ class PluginRequestInterceptor
std::string lower_scheme = StringToLowerASCII(scheme);
handled_protocols_.insert(lower_scheme);
// Only add a protocol factory if the URLRequest doesn't already handle
// Only add a protocol factory if the net::URLRequest doesn't already handle
// it. If we fail to intercept, the request will be treated as an error.
if (!URLRequest::IsHandledProtocol(lower_scheme)) {
if (!net::URLRequest::IsHandledProtocol(lower_scheme)) {
registered_protocols_.insert(lower_scheme);
URLRequest::RegisterProtocolFactory(lower_scheme,
net::URLRequest::RegisterProtocolFactory(lower_scheme,
&UninterceptedProtocolHandler);
}
}
// URLRequest::Interceptor
virtual URLRequestJob* MaybeIntercept(URLRequest* request) {
// net::URLRequest::Interceptor
virtual URLRequestJob* MaybeIntercept(net::URLRequest* request) {
// TODO(darin): This DCHECK fails in the unit tests because our interceptor
// is being persisted across unit tests. As a result, each time we get
// poked on a different thread, but never from more than one thread at a
......@@ -143,9 +143,10 @@ class PluginRequestInterceptor
};
// This class manages a network request made by the plugin, also acting as
// the URLRequest delegate.
// the net::URLRequest delegate.
// NOTE: All methods must be called on the IO thread.
class PluginRequestHandler : public PluginHelper, public URLRequest::Delegate {
class PluginRequestHandler : public PluginHelper,
public net::URLRequest::Delegate {
public:
static PluginRequestHandler* FromCPRequest(CPRequest* request) {
return ScopableCPRequest::GetData<PluginRequestHandler*>(request);
......@@ -162,15 +163,15 @@ class PluginRequestHandler : public PluginHelper, public URLRequest::Delegate {
context = Profile::GetDefaultRequestContext()->GetURLRequestContext();
GURL gurl(cprequest_->url);
request_.reset(new URLRequest(gurl, this));
request_.reset(new net::URLRequest(gurl, this));
request_->set_context(context);
request_->set_method(cprequest_->method);
request_->set_load_flags(PluginResponseUtils::CPLoadFlagsToNetFlags(0));
}
URLRequest* request() { return request_.get(); }
net::URLRequest* request() { return request_.get(); }
// Wraper of URLRequest::Read()
// Wraper of net::URLRequest::Read()
bool Read(char* dest, int dest_size, int *bytes_read) {
CHECK(!my_buffer_.get());
// We'll use our own buffer until the read actually completes.
......@@ -189,14 +190,14 @@ class PluginRequestHandler : public PluginHelper, public URLRequest::Delegate {
return false;
}
// URLRequest::Delegate
virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url,
// net::URLRequest::Delegate
virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url,
bool* defer_redirect) {
plugin_->functions().response_funcs->received_redirect(
cprequest_.get(), new_url.spec().c_str());
}
virtual void OnResponseStarted(URLRequest* request) {
virtual void OnResponseStarted(net::URLRequest* request) {
// TODO(mpcomplete): better error codes
CPError result =
request_->status().is_success() ? CPERR_SUCCESS : CPERR_FAILURE;
......@@ -204,7 +205,7 @@ class PluginRequestHandler : public PluginHelper, public URLRequest::Delegate {
cprequest_.get(), result);
}
virtual void OnReadCompleted(URLRequest* request, int bytes_read) {
virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) {
CHECK(my_buffer_.get());
CHECK(user_buffer_);
if (bytes_read > 0) {
......@@ -220,7 +221,7 @@ class PluginRequestHandler : public PluginHelper, public URLRequest::Delegate {
private:
scoped_ptr<ScopableCPRequest> cprequest_;
scoped_ptr<URLRequest> request_;
scoped_ptr<net::URLRequest> request_;
scoped_refptr<net::IOBuffer> my_buffer_;
char* user_buffer_;
};
......
......@@ -42,7 +42,8 @@ class TestURLRequestContextGetter : public URLRequestContextGetter {
scoped_refptr<URLRequestContext> context_;
};
class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
class ChromePluginTest : public testing::Test,
public net::URLRequest::Delegate {
public:
ChromePluginTest()
: io_thread_(BrowserThread::IO, &message_loop_),
......@@ -62,17 +63,18 @@ class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
// is NULL, the request is expected to fail.
void RunTest(const GURL& url, const TestResponsePayload* expected_payload);
// URLRequest::Delegate implementations
virtual void OnResponseStarted(URLRequest* request);
virtual void OnReadCompleted(URLRequest* request, int bytes_read);
// net::URLRequest::Delegate implementations
virtual void OnResponseStarted(net::URLRequest* request);
virtual void OnReadCompleted(net::URLRequest* request, int bytes_read);
// Helper called when the URLRequest is done.
// Helper called when the net::URLRequest is done.
void OnURLRequestComplete();
// testing::Test
virtual void SetUp() {
LoadPlugin();
URLRequest::RegisterProtocolFactory("test", &URLRequestTestJob::Factory);
net::URLRequest::RegisterProtocolFactory("test",
&URLRequestTestJob::Factory);
// We need to setup a default request context in order to issue HTTP
// requests.
......@@ -81,7 +83,7 @@ class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
}
virtual void TearDown() {
UnloadPlugin();
URLRequest::RegisterProtocolFactory("test", NULL);
net::URLRequest::RegisterProtocolFactory("test", NULL);
Profile::set_default_request_context(NULL);
......@@ -96,9 +98,9 @@ class ChromePluginTest : public testing::Test, public URLRequest::Delegate {
MessageLoopForIO message_loop_;
BrowserThread io_thread_;
// Note: we use URLRequest (instead of URLFetcher) because this allows the
// request to be intercepted.
scoped_ptr<URLRequest> request_;
// Note: we use net::URLRequest (instead of URLFetcher) because this allows
// the request to be intercepted.
scoped_ptr<net::URLRequest> request_;
scoped_refptr<net::IOBuffer> response_buffer_;
std::string response_data_;
......@@ -166,14 +168,14 @@ void ChromePluginTest::RunTest(const GURL& url,
expected_payload_ = expected_payload;
response_data_.clear();
request_.reset(new URLRequest(url, this));
request_.reset(new net::URLRequest(url, this));
request_->set_context(new TestURLRequestContext());
request_->Start();
MessageLoop::current()->Run();
}
void ChromePluginTest::OnResponseStarted(URLRequest* request) {
void ChromePluginTest::OnResponseStarted(net::URLRequest* request) {
DCHECK(request == request_);
int bytes_read = 0;
......@@ -182,7 +184,8 @@ void ChromePluginTest::OnResponseStarted(URLRequest* request) {
OnReadCompleted(request_.get(), bytes_read);
}
void ChromePluginTest::OnReadCompleted(URLRequest* request, int bytes_read) {
void ChromePluginTest::OnReadCompleted(net::URLRequest* request,
int bytes_read) {
DCHECK(request == request_);
do {
......
......@@ -33,24 +33,25 @@ static const char* const supported_mime_type_list[] = {
static const char* const kGViewUrlPrefix = "http://docs.google.com/gview?url=";
GViewRequestInterceptor::GViewRequestInterceptor() {
URLRequest::RegisterRequestInterceptor(this);
net::URLRequest::RegisterRequestInterceptor(this);
for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) {
supported_mime_types_.insert(supported_mime_type_list[i]);
}
}
GViewRequestInterceptor::~GViewRequestInterceptor() {
URLRequest::UnregisterRequestInterceptor(this);
net::URLRequest::UnregisterRequestInterceptor(this);
}
URLRequestJob* GViewRequestInterceptor::MaybeIntercept(URLRequest* request) {
URLRequestJob* GViewRequestInterceptor::MaybeIntercept(
net::URLRequest* request) {
// Don't attempt to intercept here as we want to wait until the mime
// type is fully determined.
return NULL;
}
URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
URLRequest* request) {
net::URLRequest* request) {
// Do not intercept this request if it is a download.
if (request->load_flags() & net::LOAD_IS_DOWNLOAD) {
return NULL;
......@@ -79,7 +80,8 @@ URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
return NULL;
}
URLRequest::Interceptor* GViewRequestInterceptor::GetGViewRequestInterceptor() {
net::URLRequest::Interceptor*
GViewRequestInterceptor::GetGViewRequestInterceptor() {
return Singleton<GViewRequestInterceptor>::get();
}
......
......@@ -18,7 +18,7 @@ namespace chromeos {
// document types (such as PDF) and redirect the request to the Google
// Document Viewer, including the document's original URL as a
// parameter.
class GViewRequestInterceptor : public URLRequest::Interceptor {
class GViewRequestInterceptor : public net::URLRequest::Interceptor {
public:
GViewRequestInterceptor();
virtual ~GViewRequestInterceptor();
......@@ -33,7 +33,7 @@ class GViewRequestInterceptor : public URLRequest::Interceptor {
virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request);
// Singleton accessor.
static URLRequest::Interceptor* GetGViewRequestInterceptor();
static net::URLRequest::Interceptor* GetGViewRequestInterceptor();
private:
// The list of supported mime types.
......
......@@ -19,7 +19,7 @@ namespace chromeos {
class GViewURLRequestTestJob : public URLRequestTestJob {
public:
explicit GViewURLRequestTestJob(URLRequest* request)
explicit GViewURLRequestTestJob(net::URLRequest* request)
: URLRequestTestJob(request, true) {
}
......@@ -49,18 +49,18 @@ class GViewURLRequestTestJob : public URLRequestTestJob {
class GViewRequestInterceptorTest : public testing::Test {
public:
virtual void SetUp() {
URLRequest::RegisterProtocolFactory("http",
net::URLRequest::RegisterProtocolFactory("http",
&GViewRequestInterceptorTest::Factory);
interceptor_ = GViewRequestInterceptor::GetGViewRequestInterceptor();
ASSERT_TRUE(PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path_));
}
virtual void TearDown() {
URLRequest::RegisterProtocolFactory("http", NULL);
net::URLRequest::RegisterProtocolFactory("http", NULL);
message_loop_.RunAllPending();
}
static URLRequestJob* Factory(URLRequest* request,
static URLRequestJob* Factory(net::URLRequest* request,
const std::string& scheme) {
return new GViewURLRequestTestJob(request);
}
......@@ -101,12 +101,12 @@ class GViewRequestInterceptorTest : public testing::Test {
protected:
MessageLoopForIO message_loop_;
TestDelegate test_delegate_;
URLRequest::Interceptor* interceptor_;
net::URLRequest::Interceptor* interceptor_;
FilePath pdf_path_;
};
TEST_F(GViewRequestInterceptorTest, DoNotInterceptHtml) {
URLRequest request(GURL("http://foo.com/index.html"), &test_delegate_);
net::URLRequest request(GURL("http://foo.com/index.html"), &test_delegate_);
request.Start();
MessageLoop::current()->Run();
EXPECT_EQ(0, test_delegate_.received_redirect_count());
......@@ -114,7 +114,7 @@ TEST_F(GViewRequestInterceptorTest, DoNotInterceptHtml) {
}
TEST_F(GViewRequestInterceptorTest, DoNotInterceptDownload) {
URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
net::URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
request.set_load_flags(net::LOAD_IS_DOWNLOAD);
request.Start();
MessageLoop::current()->Run();
......@@ -132,7 +132,7 @@ TEST_F(GViewRequestInterceptorTest, DoNotInterceptPdfWhenEnabled) {
EXPECT_TRUE(pdf_plugin_enabled);
}
URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
net::URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
request.Start();
MessageLoop::current()->Run();
EXPECT_EQ(0, test_delegate_.received_redirect_count());
......@@ -149,7 +149,7 @@ TEST_F(GViewRequestInterceptorTest, InterceptPdfWhenDisabled) {
EXPECT_TRUE(pdf_plugin_disabled);
}
URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
net::URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
request.Start();
MessageLoop::current()->Run();
EXPECT_EQ(1, test_delegate_.received_redirect_count());
......@@ -162,7 +162,7 @@ TEST_F(GViewRequestInterceptorTest, InterceptPdfWithNoPlugin) {
bool enabled;
SetPDFPluginLoadedState(false, &enabled);
URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
net::URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_);
request.Start();
MessageLoop::current()->Run();
EXPECT_EQ(1, test_delegate_.received_redirect_count());
......@@ -171,7 +171,7 @@ TEST_F(GViewRequestInterceptorTest, InterceptPdfWithNoPlugin) {
}
TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) {
URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_);
net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_);
request.Start();
MessageLoop::current()->Run();
EXPECT_EQ(1, test_delegate_.received_redirect_count());
......
......@@ -62,7 +62,7 @@ static void QuitUIMessageLoop() {
static bool inspector_called = false; // had to use global flag as
// InspectorHook() doesn't have context.
static URLRequestJob* InspectorHook(URLRequest* request,
static URLRequestJob* InspectorHook(net::URLRequest* request,
const std::string& scheme) {
VLOG(1) << "Intercepted: " << request->url() << ", scheme: " << scheme;
......
......@@ -142,7 +142,7 @@ void RegistrationScreen::CloseScreen(ScreenObserver::ExitCodes code) {
}
// static
URLRequestJob* RegistrationScreen::Factory(URLRequest* request,
URLRequestJob* RegistrationScreen::Factory(net::URLRequest* request,
const std::string& scheme) {
VLOG(1) << "Handling url: " << request->url().spec().c_str();
return new URLRequestAboutJob(request);
......
......@@ -108,7 +108,8 @@ void DevToolsHttpProtocolHandler::OnHttpRequest(
}
// Proxy static files from chrome://devtools/*.
URLRequest* request = new URLRequest(GURL("chrome:/" + info.path), this);
net::URLRequest* request = new net::URLRequest(
GURL("chrome:/" + info.path), this);
Bind(request, socket);
request->set_context(
Profile::GetDefaultRequestContext()->GetURLRequestContext());
......@@ -144,9 +145,9 @@ void DevToolsHttpProtocolHandler::OnClose(HttpListenSocket* socket) {
SocketToRequestsMap::iterator it = socket_to_requests_io_.find(socket);
if (it != socket_to_requests_io_.end()) {
// Dispose delegating socket.
for (std::set<URLRequest*>::iterator it2 = it->second.begin();
for (std::set<net::URLRequest*>::iterator it2 = it->second.begin();
it2 != it->second.end(); ++it2) {
URLRequest* request = *it2;
net::URLRequest* request = *it2;
request->Cancel();
request_to_socket_io_.erase(request);
request_to_buffer_io_.erase(request);
......@@ -273,7 +274,7 @@ void DevToolsHttpProtocolHandler::OnCloseUI(HttpListenSocket* socket) {
socket_to_client_host_ui_.erase(socket);
}
void DevToolsHttpProtocolHandler::OnResponseStarted(URLRequest* request) {
void DevToolsHttpProtocolHandler::OnResponseStarted(net::URLRequest* request) {
RequestToSocketMap::iterator it = request_to_socket_io_.find(request);
if (it == request_to_socket_io_.end())
return;
......@@ -307,7 +308,7 @@ void DevToolsHttpProtocolHandler::OnResponseStarted(URLRequest* request) {
OnReadCompleted(request, bytes_read);
}
void DevToolsHttpProtocolHandler::OnReadCompleted(URLRequest* request,
void DevToolsHttpProtocolHandler::OnReadCompleted(net::URLRequest* request,
int bytes_read) {
RequestToSocketMap::iterator it = request_to_socket_io_.find(request);
if (it == request_to_socket_io_.end())
......@@ -341,21 +342,21 @@ void DevToolsHttpProtocolHandler::Teardown() {
server_ = NULL;
}
void DevToolsHttpProtocolHandler::Bind(URLRequest* request,
void DevToolsHttpProtocolHandler::Bind(net::URLRequest* request,
HttpListenSocket* socket) {
request_to_socket_io_[request] = socket;
SocketToRequestsMap::iterator it = socket_to_requests_io_.find(socket);
if (it == socket_to_requests_io_.end()) {
std::pair<HttpListenSocket*, std::set<URLRequest*> > value(
std::pair<HttpListenSocket*, std::set<net::URLRequest*> > value(
socket,
std::set<URLRequest*>());
std::set<net::URLRequest*>());
it = socket_to_requests_io_.insert(value).first;
}
it->second.insert(request);
request_to_buffer_io_[request] = new net::IOBuffer(kBufferSize);
}
void DevToolsHttpProtocolHandler::RequestCompleted(URLRequest* request) {
void DevToolsHttpProtocolHandler::RequestCompleted(net::URLRequest* request) {
RequestToSocketMap::iterator it = request_to_socket_io_.find(request);
if (it == request_to_socket_io_.end())
return;
......
......@@ -19,7 +19,7 @@ class TabContents;
class DevToolsHttpProtocolHandler
: public HttpListenSocket::Delegate,
public URLRequest::Delegate,
public net::URLRequest::Delegate,
public base::RefCountedThreadSafe<DevToolsHttpProtocolHandler> {
public:
explicit DevToolsHttpProtocolHandler(int port);
......@@ -51,14 +51,14 @@ class DevToolsHttpProtocolHandler
const std::string& data);
virtual void OnCloseUI(HttpListenSocket* socket);
// URLRequest::Delegate implementation.
virtual void OnResponseStarted(URLRequest* request);
virtual void OnReadCompleted(URLRequest* request, int bytes_read);
// net::URLRequest::Delegate implementation.
virtual void OnResponseStarted(net::URLRequest* request);
virtual void OnReadCompleted(net::URLRequest* request, int bytes_read);
void Init();
void Teardown();
void Bind(URLRequest* request, HttpListenSocket* socket);
void RequestCompleted(URLRequest* request);
void Bind(net::URLRequest* request, HttpListenSocket* socket);
void RequestCompleted(net::URLRequest* request);
void Send200(HttpListenSocket* socket,
const std::string& data,
......@@ -73,13 +73,13 @@ class DevToolsHttpProtocolHandler
int port_;
scoped_refptr<HttpListenSocket> server_;
typedef std::map<URLRequest*, HttpListenSocket*>
typedef std::map<net::URLRequest*, HttpListenSocket*>
RequestToSocketMap;
RequestToSocketMap request_to_socket_io_;
typedef std::map<HttpListenSocket*, std::set<URLRequest*> >
typedef std::map<HttpListenSocket*, std::set<net::URLRequest*> >
SocketToRequestsMap;
SocketToRequestsMap socket_to_requests_io_;
typedef std::map<URLRequest*, scoped_refptr<net::IOBuffer> >
typedef std::map<net::URLRequest*, scoped_refptr<net::IOBuffer> >
BuffersMap;
BuffersMap request_to_buffer_io_;
typedef std::map<HttpListenSocket*, DevToolsClientHost*>
......
......@@ -126,7 +126,7 @@ DevToolsNetLogObserver* DevToolsNetLogObserver::GetInstance() {
}
// static
void DevToolsNetLogObserver::PopulateResponseInfo(URLRequest* request,
void DevToolsNetLogObserver::PopulateResponseInfo(net::URLRequest* request,
ResourceResponse* response) {
if (!(request->load_flags() & net::LOAD_REPORT_RAW_HEADERS))
return;
......
......@@ -41,7 +41,7 @@
// calls back once the data is available.
class URLRequestChromeJob : public net::URLRequestJob {
public:
explicit URLRequestChromeJob(URLRequest* request);
explicit URLRequestChromeJob(net::URLRequest* request);
// URLRequestJob implementation.
virtual void Start();
......@@ -86,7 +86,7 @@ class URLRequestChromeJob : public net::URLRequestJob {
// URLRequestChromeFileJob is a URLRequestJob that acts like a file:// URL
class URLRequestChromeFileJob : public URLRequestFileJob {
public:
URLRequestChromeFileJob(URLRequest* request, const FilePath& path);
URLRequestChromeFileJob(net::URLRequest* request, const FilePath& path);
private:
virtual ~URLRequestChromeFileJob();
......@@ -102,10 +102,10 @@ void RegisterURLRequestChromeJob() {
}
SharedResourcesDataSource::Register();
URLRequest::RegisterProtocolFactory(chrome::kChromeDevToolsScheme,
&ChromeURLDataManager::Factory);
URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme,
&ChromeURLDataManager::Factory);
net::URLRequest::RegisterProtocolFactory(chrome::kChromeDevToolsScheme,
&ChromeURLDataManager::Factory);
net::URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme,
&ChromeURLDataManager::Factory);
}
void UnregisterURLRequestChromeJob() {
......@@ -264,7 +264,7 @@ void ChromeURLDataManager::RemoveRequest(URLRequestChromeJob* job) {
void ChromeURLDataManager::DataAvailable(
RequestID request_id,
scoped_refptr<RefCountedMemory> bytes) {
// Forward this data on to the pending URLRequest, if it exists.
// Forward this data on to the pending net::URLRequest, if it exists.
PendingRequestMap::iterator i = pending_requests_.find(request_id);
if (i != pending_requests_.end()) {
// We acquire a reference to the job so that it doesn't disappear under the
......@@ -318,7 +318,7 @@ void ChromeURLDataManager::DataSource::SetFontAndTextDirection(
base::i18n::IsRTL() ? "rtl" : "ltr");
}
URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
URLRequestJob* ChromeURLDataManager::Factory(net::URLRequest* request,
const std::string& scheme) {
// Try first with a file handler
FilePath path;
......@@ -341,7 +341,7 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
return new URLRequestChromeJob(request);
}
URLRequestChromeJob::URLRequestChromeJob(URLRequest* request)
URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request)
: URLRequestJob(request),
data_offset_(0),
pending_buf_size_(0) {
......@@ -427,7 +427,7 @@ void URLRequestChromeJob::StartAsync() {
}
}
URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request,
URLRequestChromeFileJob::URLRequestChromeFileJob(net::URLRequest* request,
const FilePath& path)
: URLRequestFileJob(request, path) {
}
......
......@@ -538,7 +538,7 @@ void MediaPlayer::PopupMediaPlayer(Browser* creator) {
mediaplayer_browser_->window()->Show();
}
URLRequestJob* MediaPlayer::MaybeIntercept(URLRequest* request) {
URLRequestJob* MediaPlayer::MaybeIntercept(net::URLRequest* request) {
// Don't attempt to intercept here as we want to wait until the mime
// type is fully determined.
return NULL;
......@@ -553,7 +553,7 @@ static const char* const supported_mime_type_list[] = {
};
URLRequestJob* MediaPlayer::MaybeInterceptResponse(
URLRequest* request) {
net::URLRequest* request) {
// Do not intercept this request if it is a download.
if (request->load_flags() & net::LOAD_IS_DOWNLOAD) {
return NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment