| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 CompletionCallback* callback, | 106 CompletionCallback* callback, |
| 107 RequestHandle* request, | 107 RequestHandle* request, |
| 108 const BoundNetLog& net_log) { | 108 const BoundNetLog& net_log) { |
| 109 return ERR_NOT_IMPLEMENTED; | 109 return ERR_NOT_IMPLEMENTED; |
| 110 } | 110 } |
| 111 | 111 |
| 112 virtual void CancelRequest(RequestHandle request) { | 112 virtual void CancelRequest(RequestHandle request) { |
| 113 NOTREACHED(); | 113 NOTREACHED(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 virtual void CancelSetPacScript() { |
| 117 NOTREACHED(); |
| 118 } |
| 119 |
| 116 virtual int SetPacScript( | 120 virtual int SetPacScript( |
| 117 const scoped_refptr<ProxyResolverScriptData>& /*script_data*/, | 121 const scoped_refptr<ProxyResolverScriptData>& /*script_data*/, |
| 118 CompletionCallback* /*callback*/) { | 122 CompletionCallback* /*callback*/) { |
| 119 return ERR_NOT_IMPLEMENTED; | 123 return ERR_NOT_IMPLEMENTED; |
| 120 } | 124 } |
| 121 }; | 125 }; |
| 122 | 126 |
| 123 // ProxyResolver that simulates a PAC script which returns | 127 // ProxyResolver that simulates a PAC script which returns |
| 124 // |pac_string| for every single URL. | 128 // |pac_string| for every single URL. |
| 125 class ProxyResolverFromPacString : public ProxyResolver { | 129 class ProxyResolverFromPacString : public ProxyResolver { |
| 126 public: | 130 public: |
| 127 ProxyResolverFromPacString(const std::string& pac_string) | 131 ProxyResolverFromPacString(const std::string& pac_string) |
| 128 : ProxyResolver(false /*expects_pac_bytes*/), | 132 : ProxyResolver(false /*expects_pac_bytes*/), |
| 129 pac_string_(pac_string) {} | 133 pac_string_(pac_string) {} |
| 130 | 134 |
| 131 virtual int GetProxyForURL(const GURL& url, | 135 virtual int GetProxyForURL(const GURL& url, |
| 132 ProxyInfo* results, | 136 ProxyInfo* results, |
| 133 CompletionCallback* callback, | 137 CompletionCallback* callback, |
| 134 RequestHandle* request, | 138 RequestHandle* request, |
| 135 const BoundNetLog& net_log) { | 139 const BoundNetLog& net_log) { |
| 136 results->UsePacString(pac_string_); | 140 results->UsePacString(pac_string_); |
| 137 return OK; | 141 return OK; |
| 138 } | 142 } |
| 139 | 143 |
| 140 virtual void CancelRequest(RequestHandle request) { | 144 virtual void CancelRequest(RequestHandle request) { |
| 141 NOTREACHED(); | 145 NOTREACHED(); |
| 142 } | 146 } |
| 143 | 147 |
| 148 virtual void CancelSetPacScript() { |
| 149 NOTREACHED(); |
| 150 } |
| 151 |
| 144 virtual int SetPacScript( | 152 virtual int SetPacScript( |
| 145 const scoped_refptr<ProxyResolverScriptData>& pac_script, | 153 const scoped_refptr<ProxyResolverScriptData>& pac_script, |
| 146 CompletionCallback* callback) { | 154 CompletionCallback* callback) { |
| 147 return OK; | 155 return OK; |
| 148 } | 156 } |
| 149 | 157 |
| 150 private: | 158 private: |
| 151 const std::string pac_string_; | 159 const std::string pac_string_; |
| 152 }; | 160 }; |
| 153 | 161 |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 OnCompletion(result_); | 939 OnCompletion(result_); |
| 932 } | 940 } |
| 933 } | 941 } |
| 934 | 942 |
| 935 void SyncProxyServiceHelper::OnCompletion(int rv) { | 943 void SyncProxyServiceHelper::OnCompletion(int rv) { |
| 936 result_ = rv; | 944 result_ = rv; |
| 937 event_.Signal(); | 945 event_.Signal(); |
| 938 } | 946 } |
| 939 | 947 |
| 940 } // namespace net | 948 } // namespace net |
| OLD | NEW |