• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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.
4 
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.
8 
9 #include "net/url_request/url_request_about_job.h"
10 
11 #include "base/compiler_specific.h"
12 #include "base/message_loop.h"
13 
14 namespace net {
15 
URLRequestAboutJob(URLRequest * request)16 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request)
17     : URLRequestJob(request),
18       ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
19 }
20 
21 // static
Factory(URLRequest * request,const std::string & scheme)22 URLRequestJob* URLRequestAboutJob::Factory(URLRequest* request,
23                                            const std::string& scheme) {
24   return new URLRequestAboutJob(request);
25 }
26 
Start()27 void URLRequestAboutJob::Start() {
28   // Start reading asynchronously so that all error reporting and data
29   // callbacks happen as they would for network requests.
30   MessageLoop::current()->PostTask(
31       FROM_HERE,
32       method_factory_.NewRunnableMethod(&URLRequestAboutJob::StartAsync));
33 }
34 
GetMimeType(std::string * mime_type) const35 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const {
36   *mime_type = "text/html";
37   return true;
38 }
39 
~URLRequestAboutJob()40 URLRequestAboutJob::~URLRequestAboutJob() {
41 }
42 
StartAsync()43 void URLRequestAboutJob::StartAsync() {
44   NotifyHeadersComplete();
45 }
46 
47 }  // namespace net
48