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 // This class simulates what wininet does when a dns lookup fails. | 4 // This class simulates what wininet does when a dns lookup fails. |
5 | 5 |
6 #include <algorithm> | 6 #include <algorithm> |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 URLRequestAbortOnEndJob::~URLRequestAbortOnEndJob() { | 69 URLRequestAbortOnEndJob::~URLRequestAbortOnEndJob() { |
70 } | 70 } |
71 | 71 |
72 void URLRequestAbortOnEndJob::GetResponseInfo(net::HttpResponseInfo* info) { | 72 void URLRequestAbortOnEndJob::GetResponseInfo(net::HttpResponseInfo* info) { |
73 GetResponseInfoConst(info); | 73 GetResponseInfoConst(info); |
74 } | 74 } |
75 | 75 |
76 bool URLRequestAbortOnEndJob::GetMimeType(std::string* mime_type) const { | 76 bool URLRequestAbortOnEndJob::GetMimeType(std::string* mime_type) const { |
77 net::HttpResponseInfo info; | 77 net::HttpResponseInfo info; |
78 GetResponseInfoConst(&info); | 78 GetResponseInfoConst(&info); |
79 return info.headers && info.headers->GetMimeType(mime_type); | 79 return info.headers.get() && info.headers->GetMimeType(mime_type); |
80 } | 80 } |
81 | 81 |
82 void URLRequestAbortOnEndJob::StartAsync() { | 82 void URLRequestAbortOnEndJob::StartAsync() { |
83 NotifyHeadersComplete(); | 83 NotifyHeadersComplete(); |
84 } | 84 } |
85 | 85 |
86 void URLRequestAbortOnEndJob::Start() { | 86 void URLRequestAbortOnEndJob::Start() { |
87 MessageLoop::current()->PostTask( | 87 MessageLoop::current()->PostTask( |
88 FROM_HERE, | 88 FROM_HERE, |
89 base::Bind(&URLRequestAbortOnEndJob::StartAsync, | 89 base::Bind(&URLRequestAbortOnEndJob::StartAsync, |
(...skipping 10 matching lines...) Expand all Loading... |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 103 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
104 net::ERR_CONNECTION_ABORTED)); | 104 net::ERR_CONNECTION_ABORTED)); |
105 *bytes_read = -1; | 105 *bytes_read = -1; |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 } // namespace content | 109 } // namespace content |
OLD | NEW |