Chromium Code Reviews| 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 "components/about_handler/url_request_about_job.h" | 9 #include "components/about_handler/url_request_about_job.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 } | 23 } |
| 24 | 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 base::ThreadTaskRunnerHandle::Get()->PostTask( | 28 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 29 FROM_HERE, | 29 FROM_HERE, |
| 30 base::Bind(&URLRequestAboutJob::StartAsync, weak_factory_.GetWeakPtr())); | 30 base::Bind(&URLRequestAboutJob::StartAsync, weak_factory_.GetWeakPtr())); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void URLRequestAboutJob::Kill() { | |
| 34 URLRequestJob::Kill(); | |
| 35 weak_factory_.InvalidateWeakPtrs(); | |
|
davidben
2015/10/08 16:16:36
Nit: Completely doesn't matter here, but I've seen
mmenke
2015/10/08 16:20:42
Makes sense. That also the reverse of constructio
| |
| 36 } | |
| 37 | |
| 33 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { | 38 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { |
| 34 *mime_type = "text/html"; | 39 *mime_type = "text/html"; |
| 35 return true; | 40 return true; |
| 36 } | 41 } |
| 37 | 42 |
| 38 URLRequestAboutJob::~URLRequestAboutJob() { | 43 URLRequestAboutJob::~URLRequestAboutJob() { |
| 39 } | 44 } |
| 40 | 45 |
| 41 void URLRequestAboutJob::StartAsync() { | 46 void URLRequestAboutJob::StartAsync() { |
| 42 NotifyHeadersComplete(); | 47 NotifyHeadersComplete(); |
| 43 } | 48 } |
| 44 | 49 |
| 45 } // namespace about_handler | 50 } // namespace about_handler |
| OLD | NEW |