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
3 // found in the LICENSE file.
5 // Simple implementation of about: protocol handler that treats everything as
6 // about:blank. No other about: features should be available to web content,
7 // so they're not implemented here.
9 #include "components/about_handler/url_request_about_job.h"
11 #include "base/bind.h"
12 #include "base/compiler_specific.h"
13 #include "base/location.h"
14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h"
17 namespace about_handler
{
19 URLRequestAboutJob::URLRequestAboutJob(net::URLRequest
* request
,
20 net::NetworkDelegate
* network_delegate
)
21 : URLRequestJob(request
, network_delegate
),
25 void URLRequestAboutJob::Start() {
26 // Start reading asynchronously so that all error reporting and data
27 // callbacks happen as they would for network requests.
28 base::ThreadTaskRunnerHandle::Get()->PostTask(
30 base::Bind(&URLRequestAboutJob::StartAsync
, weak_factory_
.GetWeakPtr()));
33 bool URLRequestAboutJob::GetMimeType(std::string
* mime_type
) const {
34 *mime_type
= "text/html";
38 URLRequestAboutJob::~URLRequestAboutJob() {
41 void URLRequestAboutJob::StartAsync() {
42 NotifyHeadersComplete();
45 } // namespace about_handler