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