OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Simple implementation of about: protocol handler that treats everything as | 5 // Simple implementation of about: protocol handler that treats everything as |
6 // about:blank. No other about: features should be available to web content, | 6 // about:blank. No other about: features should be available to web content, |
7 // so they're not implemented here. | 7 // so they're not implemented here. |
8 | 8 |
9 #include "net/url_request/url_request_about_job.h" | 9 #include "net/url_request/url_request_about_job.h" |
10 | 10 |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 | 12 |
13 // static | 13 // static |
14 URLRequestJob* URLRequestAboutJob::Factory(net::URLRequest* request, | 14 net::URLRequestJob* URLRequestAboutJob::Factory(net::URLRequest* request, |
15 const std::string& scheme) { | 15 const std::string& scheme) { |
16 return new URLRequestAboutJob(request); | 16 return new URLRequestAboutJob(request); |
17 } | 17 } |
18 | 18 |
19 URLRequestAboutJob::URLRequestAboutJob(net::URLRequest* request) | 19 URLRequestAboutJob::URLRequestAboutJob(net::URLRequest* request) |
20 : URLRequestJob(request) { | 20 : net::URLRequestJob(request) { |
21 } | 21 } |
22 | 22 |
23 void URLRequestAboutJob::Start() { | 23 void URLRequestAboutJob::Start() { |
24 // Start reading asynchronously so that all error reporting and data | 24 // Start reading asynchronously so that all error reporting and data |
25 // callbacks happen as they would for network requests. | 25 // callbacks happen as they would for network requests. |
26 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 26 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
27 this, &URLRequestAboutJob::StartAsync)); | 27 this, &URLRequestAboutJob::StartAsync)); |
28 } | 28 } |
29 | 29 |
30 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { | 30 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { |
31 *mime_type = "text/html"; | 31 *mime_type = "text/html"; |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 URLRequestAboutJob::~URLRequestAboutJob() { | 35 URLRequestAboutJob::~URLRequestAboutJob() { |
36 } | 36 } |
37 | 37 |
38 void URLRequestAboutJob::StartAsync() { | 38 void URLRequestAboutJob::StartAsync() { |
39 NotifyHeadersComplete(); | 39 NotifyHeadersComplete(); |
40 } | 40 } |
OLD | NEW |