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 namespace net { | 13 namespace net { |
14 | 14 |
| 15 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request) |
| 16 : URLRequestJob(request) { |
| 17 } |
| 18 |
15 // static | 19 // static |
16 URLRequestJob* URLRequestAboutJob::Factory(URLRequest* request, | 20 URLRequestJob* URLRequestAboutJob::Factory(URLRequest* request, |
17 const std::string& scheme) { | 21 const std::string& scheme) { |
18 return new URLRequestAboutJob(request); | 22 return new URLRequestAboutJob(request); |
19 } | 23 } |
20 | 24 |
21 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request) | |
22 : URLRequestJob(request) { | |
23 } | |
24 | |
25 void URLRequestAboutJob::Start() { | 25 void URLRequestAboutJob::Start() { |
26 // Start reading asynchronously so that all error reporting and data | 26 // Start reading asynchronously so that all error reporting and data |
27 // callbacks happen as they would for network requests. | 27 // callbacks happen as they would for network requests. |
28 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 28 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
29 this, &URLRequestAboutJob::StartAsync)); | 29 this, &URLRequestAboutJob::StartAsync)); |
30 } | 30 } |
31 | 31 |
32 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { | 32 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { |
33 *mime_type = "text/html"; | 33 *mime_type = "text/html"; |
34 return true; | 34 return true; |
35 } | 35 } |
36 | 36 |
37 URLRequestAboutJob::~URLRequestAboutJob() { | 37 URLRequestAboutJob::~URLRequestAboutJob() { |
38 } | 38 } |
39 | 39 |
40 void URLRequestAboutJob::StartAsync() { | 40 void URLRequestAboutJob::StartAsync() { |
41 NotifyHeadersComplete(); | 41 NotifyHeadersComplete(); |
42 } | 42 } |
43 | 43 |
44 } // namespace net | 44 } // namespace net |
OLD | NEW |