| 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/location.h" | 10 #include "base/location.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(Interceptor); | 45 DISALLOW_COPY_AND_ASSIGN(Interceptor); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 void AddUrlHandlerOnIOThread() { | 48 void AddUrlHandlerOnIOThread() { |
| 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 50 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 50 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
| 51 filter->AddUrlInterceptor( | 51 filter->AddUrlInterceptor( |
| 52 GURL(URLRequestAbortOnEndJob::k400AbortOnEndUrl), | 52 GURL(URLRequestAbortOnEndJob::k400AbortOnEndUrl), |
| 53 scoped_ptr<net::URLRequestInterceptor>(new Interceptor())); | 53 std::unique_ptr<net::URLRequestInterceptor>(new Interceptor())); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // anonymous namespace | 56 } // anonymous namespace |
| 57 | 57 |
| 58 const char URLRequestAbortOnEndJob::k400AbortOnEndUrl[] = | 58 const char URLRequestAbortOnEndJob::k400AbortOnEndUrl[] = |
| 59 "http://url.handled.by.abort.on.end/400"; | 59 "http://url.handled.by.abort.on.end/400"; |
| 60 | 60 |
| 61 // static | 61 // static |
| 62 void URLRequestAbortOnEndJob::AddUrlHandler() { | 62 void URLRequestAbortOnEndJob::AddUrlHandler() { |
| 63 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 63 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 std::min(max_bytes, base::checked_cast<int>(sizeof(kPageContent))); | 119 std::min(max_bytes, base::checked_cast<int>(sizeof(kPageContent))); |
| 120 std::memcpy(buf->data(), kPageContent, max_bytes); | 120 std::memcpy(buf->data(), kPageContent, max_bytes); |
| 121 sent_data_ = true; | 121 sent_data_ = true; |
| 122 return max_bytes; | 122 return max_bytes; |
| 123 } | 123 } |
| 124 | 124 |
| 125 return net::ERR_CONNECTION_ABORTED; | 125 return net::ERR_CONNECTION_ABORTED; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace content | 128 } // namespace content |
| OLD | NEW |