OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 11 #include "base/bind.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
15 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
mmenke
2012/08/21 15:28:49
Don't think we need either of these two.
shalev
2012/08/22 20:34:10
Done.
| |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request) | 19 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request, |
20 : URLRequestJob(request, request->context()->network_delegate()), | 20 NetworkDelegate* network_delegate) |
21 : URLRequestJob(request, network_delegate), | |
21 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 22 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
22 } | 23 } |
23 | 24 |
24 // static | 25 // static |
25 URLRequestJob* URLRequestAboutJob::Factory(URLRequest* request, | 26 URLRequestJob* URLRequestAboutJob::Factory(URLRequest* request, |
27 NetworkDelegate* network_delegate, | |
26 const std::string& scheme) { | 28 const std::string& scheme) { |
27 return new URLRequestAboutJob(request); | 29 return new URLRequestAboutJob(request, network_delegate); |
28 } | 30 } |
29 | 31 |
30 void URLRequestAboutJob::Start() { | 32 void URLRequestAboutJob::Start() { |
31 // Start reading asynchronously so that all error reporting and data | 33 // Start reading asynchronously so that all error reporting and data |
32 // callbacks happen as they would for network requests. | 34 // callbacks happen as they would for network requests. |
33 MessageLoop::current()->PostTask( | 35 MessageLoop::current()->PostTask( |
34 FROM_HERE, | 36 FROM_HERE, |
35 base::Bind(&URLRequestAboutJob::StartAsync, weak_factory_.GetWeakPtr())); | 37 base::Bind(&URLRequestAboutJob::StartAsync, weak_factory_.GetWeakPtr())); |
36 } | 38 } |
37 | 39 |
38 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { | 40 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { |
39 *mime_type = "text/html"; | 41 *mime_type = "text/html"; |
40 return true; | 42 return true; |
41 } | 43 } |
42 | 44 |
43 URLRequestAboutJob::~URLRequestAboutJob() { | 45 URLRequestAboutJob::~URLRequestAboutJob() { |
44 } | 46 } |
45 | 47 |
46 void URLRequestAboutJob::StartAsync() { | 48 void URLRequestAboutJob::StartAsync() { |
47 NotifyHeadersComplete(); | 49 NotifyHeadersComplete(); |
48 } | 50 } |
49 | 51 |
50 } // namespace net | 52 } // namespace net |
OLD | NEW |