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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 URLRequestAbortOnEndJob::~URLRequestAbortOnEndJob() { | 76 URLRequestAbortOnEndJob::~URLRequestAbortOnEndJob() { |
77 } | 77 } |
78 | 78 |
79 void URLRequestAbortOnEndJob::GetResponseInfo(net::HttpResponseInfo* info) { | 79 void URLRequestAbortOnEndJob::GetResponseInfo(net::HttpResponseInfo* info) { |
80 GetResponseInfoConst(info); | 80 GetResponseInfoConst(info); |
81 } | 81 } |
82 | 82 |
83 bool URLRequestAbortOnEndJob::GetMimeType(std::string* mime_type) const { | 83 bool URLRequestAbortOnEndJob::GetMimeType(std::string* mime_type) const { |
84 net::HttpResponseInfo info; | 84 net::HttpResponseInfo info; |
85 GetResponseInfoConst(&info); | 85 GetResponseInfoConst(&info); |
86 return info.headers && info.headers->GetMimeType(mime_type); | 86 return info.headers.get() && info.headers->GetMimeType(mime_type); |
87 } | 87 } |
88 | 88 |
89 void URLRequestAbortOnEndJob::StartAsync() { | 89 void URLRequestAbortOnEndJob::StartAsync() { |
90 NotifyHeadersComplete(); | 90 NotifyHeadersComplete(); |
91 } | 91 } |
92 | 92 |
93 void URLRequestAbortOnEndJob::Start() { | 93 void URLRequestAbortOnEndJob::Start() { |
94 base::MessageLoop::current()->PostTask( | 94 base::MessageLoop::current()->PostTask( |
95 FROM_HERE, | 95 FROM_HERE, |
96 base::Bind(&URLRequestAbortOnEndJob::StartAsync, | 96 base::Bind(&URLRequestAbortOnEndJob::StartAsync, |
(...skipping 10 matching lines...) Expand all Loading... |
107 return true; | 107 return true; |
108 } | 108 } |
109 | 109 |
110 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 110 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
111 net::ERR_CONNECTION_ABORTED)); | 111 net::ERR_CONNECTION_ABORTED)); |
112 *bytes_read = -1; | 112 *bytes_read = -1; |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 } // namespace content | 116 } // namespace content |
OLD | NEW |