Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: components/about_handler/url_request_about_job.cc

Issue 1284173003: Create a about handler component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/about_handler/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/location.h" 13 #include "base/location.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 16
17 namespace net { 17 namespace net {
droger 2015/08/12 13:03:25 namespace about_handler {
Jitu( very slow this week) 2015/08/12 14:34:17 Done.
18 18
19 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request, 19 URLRequestAboutJob::URLRequestAboutJob(URLRequest* request,
20 NetworkDelegate* network_delegate) 20 NetworkDelegate* network_delegate)
21 : URLRequestJob(request, network_delegate), 21 : URLRequestJob(request, network_delegate),
22 weak_factory_(this) { 22 weak_factory_(this) {
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 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { 33 bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const {
34 *mime_type = "text/html"; 34 *mime_type = "text/html";
35 return true; 35 return true;
36 } 36 }
37 37
38 URLRequestAboutJob::~URLRequestAboutJob() { 38 URLRequestAboutJob::~URLRequestAboutJob() {
39 } 39 }
40 40
41 void URLRequestAboutJob::StartAsync() { 41 void URLRequestAboutJob::StartAsync() {
42 NotifyHeadersComplete(); 42 NotifyHeadersComplete();
43 } 43 }
44 44
45 } // namespace net 45 } // namespace net
droger 2015/08/12 13:03:25 } // namespace about_handler
Jitu( very slow this week) 2015/08/12 14:34:17 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698