| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/net/spdyproxy/proxy_advisor.h" | 5 #include "chrome/browser/net/spdyproxy/proxy_advisor.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 if (!WouldProxyURL(url)) | 113 if (!WouldProxyURL(url)) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 std::string motivation_name(MotivationName(motivation, is_preconnect)); | 116 std::string motivation_name(MotivationName(motivation, is_preconnect)); |
| 117 std::string header_value = motivation_name + " " + url.spec(); | 117 std::string header_value = motivation_name + " " + url.spec(); |
| 118 net::URLRequestContext* context = context_getter_->GetURLRequestContext(); | 118 net::URLRequestContext* context = context_getter_->GetURLRequestContext(); |
| 119 std::string endpoint = | 119 std::string endpoint = |
| 120 DataReductionProxySettings::GetDataReductionProxyOrigin() + "preconnect"; | 120 DataReductionProxySettings::GetDataReductionProxyOrigin() + "preconnect"; |
| 121 scoped_ptr<net::URLRequest> request = context->CreateRequest( | 121 scoped_ptr<net::URLRequest> request = context->CreateRequest( |
| 122 GURL(endpoint), net::DEFAULT_PRIORITY, this); | 122 GURL(endpoint), net::DEFAULT_PRIORITY, this, NULL); |
| 123 request->set_method("HEAD"); | 123 request->set_method("HEAD"); |
| 124 request->SetExtraRequestHeaderByName( | 124 request->SetExtraRequestHeaderByName( |
| 125 "Proxy-Host-Advisory", header_value, false); | 125 "Proxy-Host-Advisory", header_value, false); |
| 126 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 126 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 127 net::LOAD_DO_NOT_SAVE_COOKIES | | 127 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 128 net::LOAD_BYPASS_PROXY | | 128 net::LOAD_BYPASS_PROXY | |
| 129 net::LOAD_DISABLE_CACHE); | 129 net::LOAD_DISABLE_CACHE); |
| 130 net::URLRequest* raw_request = request.get(); | 130 net::URLRequest* raw_request = request.get(); |
| 131 inflight_requests_.insert(request.release()); | 131 inflight_requests_.insert(request.release()); |
| 132 raw_request->Start(); | 132 raw_request->Start(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 150 scoped_ptr<net::URLRequest> scoped_request_for_deletion(request); | 150 scoped_ptr<net::URLRequest> scoped_request_for_deletion(request); |
| 151 inflight_requests_.erase(request); | 151 inflight_requests_.erase(request); |
| 152 // |scoped_request_for_deletion| will delete |request| | 152 // |scoped_request_for_deletion| will delete |request| |
| 153 } | 153 } |
| 154 | 154 |
| 155 void ProxyAdvisor::UpdateProxyState() { | 155 void ProxyAdvisor::UpdateProxyState() { |
| 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 157 // Delete all inflight requests. Each request's destructor will call Cancel(). | 157 // Delete all inflight requests. Each request's destructor will call Cancel(). |
| 158 STLDeleteElements(&inflight_requests_); | 158 STLDeleteElements(&inflight_requests_); |
| 159 } | 159 } |
| OLD | NEW |