| OLD | NEW |
| 1 // Copyright (c) 2009 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 "base/string_util.h" | 5 #include "base/string_number_conversions.h" |
| 6 #include "chrome/common/automation_constants.h" | 6 #include "chrome/common/automation_constants.h" |
| 7 #include "chrome/common/json_value_serializer.h" | 7 #include "chrome/common/json_value_serializer.h" |
| 8 #include "chrome_frame/np_proxy_service.h" | 8 #include "chrome_frame/np_proxy_service.h" |
| 9 #include "chrome_frame/np_browser_functions.h" | 9 #include "chrome_frame/np_browser_functions.h" |
| 10 | 10 |
| 11 #include "net/proxy/proxy_config.h" | 11 #include "net/proxy/proxy_config.h" |
| 12 | 12 |
| 13 #include "third_party/xulrunner-sdk/win/include/xpcom/nsXPCOM.h" | 13 #include "third_party/xulrunner-sdk/win/include/xpcom/nsXPCOM.h" |
| 14 #include "third_party/xulrunner-sdk/win/include/xpcom/nsIObserverService.h" | 14 #include "third_party/xulrunner-sdk/win/include/xpcom/nsIObserverService.h" |
| 15 #include "third_party/xulrunner-sdk/win/include/xpcom/nsISupportsUtils.h" | 15 #include "third_party/xulrunner-sdk/win/include/xpcom/nsISupportsUtils.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 std::string manual_proxy_settings; | 269 std::string manual_proxy_settings; |
| 270 ManualProxyList::const_iterator iter(manual_proxies_.begin()); | 270 ManualProxyList::const_iterator iter(manual_proxies_.begin()); |
| 271 for (; iter != manual_proxies_.end(); iter++) { | 271 for (; iter != manual_proxies_.end(); iter++) { |
| 272 DCHECK(!iter->scheme.empty()); | 272 DCHECK(!iter->scheme.empty()); |
| 273 DCHECK(!iter->url.empty()); | 273 DCHECK(!iter->url.empty()); |
| 274 DCHECK(iter->port != kInvalidIntPref); | 274 DCHECK(iter->port != kInvalidIntPref); |
| 275 manual_proxy_settings += iter->scheme; | 275 manual_proxy_settings += iter->scheme; |
| 276 manual_proxy_settings += "="; | 276 manual_proxy_settings += "="; |
| 277 manual_proxy_settings += iter->url; | 277 manual_proxy_settings += iter->url; |
| 278 manual_proxy_settings += ":"; | 278 manual_proxy_settings += ":"; |
| 279 manual_proxy_settings += IntToString(iter->port); | 279 manual_proxy_settings += base::IntToString(iter->port); |
| 280 manual_proxy_settings += ";"; | 280 manual_proxy_settings += ";"; |
| 281 } | 281 } |
| 282 | 282 |
| 283 if (!manual_proxy_settings.empty()) { | 283 if (!manual_proxy_settings.empty()) { |
| 284 proxy_settings_value->SetString(automation::kJSONProxyServer, | 284 proxy_settings_value->SetString(automation::kJSONProxyServer, |
| 285 manual_proxy_settings); | 285 manual_proxy_settings); |
| 286 } | 286 } |
| 287 | 287 |
| 288 return proxy_settings_value.release(); | 288 return proxy_settings_value.release(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 bool NpProxyService::GetProxyValueJSONString(std::string* output) { | 291 bool NpProxyService::GetProxyValueJSONString(std::string* output) { |
| 292 DCHECK(output); | 292 DCHECK(output); |
| 293 output->empty(); | 293 output->empty(); |
| 294 | 294 |
| 295 // If we detected a PROXY_CONFIG_SYSTEM config type or failed to obtain the | 295 // If we detected a PROXY_CONFIG_SYSTEM config type or failed to obtain the |
| 296 // pref service then return false here to make Chrome continue using its | 296 // pref service then return false here to make Chrome continue using its |
| 297 // default proxy settings. | 297 // default proxy settings. |
| 298 if (system_config_ || !pref_service_) | 298 if (system_config_ || !pref_service_) |
| 299 return false; | 299 return false; |
| 300 | 300 |
| 301 scoped_ptr<DictionaryValue> proxy_settings_value(BuildProxyValueSet()); | 301 scoped_ptr<DictionaryValue> proxy_settings_value(BuildProxyValueSet()); |
| 302 | 302 |
| 303 JSONStringValueSerializer serializer(output); | 303 JSONStringValueSerializer serializer(output); |
| 304 return serializer.Serialize(*static_cast<Value*>(proxy_settings_value.get())); | 304 return serializer.Serialize(*static_cast<Value*>(proxy_settings_value.get())); |
| 305 } | 305 } |
| OLD | NEW |