| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 5 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
| 10 #include "net/url_request/url_request_test_job.h" | 10 #include "net/url_request/url_request_test_job.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 virtual int GetResponseCode() const { return 200; } | 26 virtual int GetResponseCode() const { return 200; } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 ~AutoUpdateTestRequestJob() {} | 29 ~AutoUpdateTestRequestJob() {} |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 | 32 |
| 33 AutoUpdateInterceptor::AutoUpdateInterceptor() { | 33 AutoUpdateInterceptor::AutoUpdateInterceptor() { |
| 34 net::URLRequest::RegisterRequestInterceptor(this); | 34 net::URLRequest::Deprecated::RegisterRequestInterceptor(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 AutoUpdateInterceptor::~AutoUpdateInterceptor() { | 37 AutoUpdateInterceptor::~AutoUpdateInterceptor() { |
| 38 net::URLRequest::UnregisterRequestInterceptor(this); | 38 net::URLRequest::Deprecated::UnregisterRequestInterceptor(this); |
| 39 } | 39 } |
| 40 | 40 |
| 41 net::URLRequestJob* AutoUpdateInterceptor::MaybeIntercept( | 41 net::URLRequestJob* AutoUpdateInterceptor::MaybeIntercept( |
| 42 net::URLRequest* request) { | 42 net::URLRequest* request) { |
| 43 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 43 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 44 if (request->url().scheme() != "http" || | 44 if (request->url().scheme() != "http" || |
| 45 request->url().host() != "localhost") { | 45 request->url().host() != "localhost") { |
| 46 return NULL; | 46 return NULL; |
| 47 } | 47 } |
| 48 | 48 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 responses_[gurl] = path; | 81 responses_[gurl] = path; |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 void AutoUpdateInterceptor::SetResponseOnIOThread(const std::string url, | 85 void AutoUpdateInterceptor::SetResponseOnIOThread(const std::string url, |
| 86 const FilePath& path) { | 86 const FilePath& path) { |
| 87 BrowserThread::PostTask( | 87 BrowserThread::PostTask( |
| 88 BrowserThread::IO, FROM_HERE, | 88 BrowserThread::IO, FROM_HERE, |
| 89 NewRunnableMethod(this, &AutoUpdateInterceptor::SetResponse, url, path)); | 89 NewRunnableMethod(this, &AutoUpdateInterceptor::SetResponse, url, path)); |
| 90 } | 90 } |
| OLD | NEW |