OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h " | 9 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h " |
10 #include "net/proxy/proxy_info.h" | 10 #include "net/proxy/proxy_info.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 request->context()->proxy_service()->config().proxy_rules().Apply( | 316 request->context()->proxy_service()->config().proxy_rules().Apply( |
317 request->url(), &result); | 317 request->url(), &result); |
318 if (!result.proxy_server().is_valid()) | 318 if (!result.proxy_server().is_valid()) |
319 return false; | 319 return false; |
320 if (result.proxy_server().is_direct()) | 320 if (result.proxy_server().is_direct()) |
321 return false; | 321 return false; |
322 return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL); | 322 return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL); |
323 } | 323 } |
324 | 324 |
325 std::string DataReductionProxyParams::GetDefaultDevOrigin() const { | 325 std::string DataReductionProxyParams::GetDefaultDevOrigin() const { |
326 #if defined(DATA_REDUCTION_DEV_HOST) | |
327 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 326 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
328 if (command_line.HasSwitch(switches::kDisableDataReductionProxyDev)) | 327 if (command_line.HasSwitch(switches::kDisableDataReductionProxyDev)) |
329 return std::string(); | 328 return std::string(); |
330 if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) || | 329 if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) || |
331 (FieldTrialList::FindFullName("DataCompressionProxyDevRollout") == | 330 (FieldTrialList::FindFullName("DataCompressionProxyDevRollout") == |
332 kEnabled)) { | 331 kEnabled)) { |
333 return DATA_REDUCTION_DEV_HOST; | 332 return "http://proxy-dev.googlezip.net:80/"; |
bengr
2014/07/18 19:41:44
I would define all of these as const char[]s in an
Not at Google. Contact bengr
2014/07/21 17:46:25
Done.
| |
334 } | 333 } |
335 #endif | |
336 return std::string(); | 334 return std::string(); |
337 } | 335 } |
338 | 336 // TODO(kundaji): Remove tests for macro definitions. |
339 std::string DataReductionProxyParams::GetDefaultOrigin() const { | 337 std::string DataReductionProxyParams::GetDefaultOrigin() const { |
340 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 338 return "https://proxy.googlezip.net:443/"; |
341 return SPDY_PROXY_AUTH_ORIGIN; | |
342 #endif | |
343 return std::string(); | |
344 } | 339 } |
345 | 340 |
346 std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const { | 341 std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const { |
347 #if defined(DATA_REDUCTION_FALLBACK_HOST) | 342 return "http://compress.googlezip.net:80/"; |
348 return DATA_REDUCTION_FALLBACK_HOST; | |
349 #endif | |
350 return std::string(); | |
351 } | 343 } |
352 | 344 |
353 std::string DataReductionProxyParams::GetDefaultSSLOrigin() const { | 345 std::string DataReductionProxyParams::GetDefaultSSLOrigin() const { |
354 #if defined(DATA_REDUCTION_PROXY_SSL_ORIGIN) | 346 return "http://ssl.googlezip.net:1043/"; |
355 return DATA_REDUCTION_PROXY_SSL_ORIGIN; | |
356 #endif | |
357 return std::string(); | |
358 } | 347 } |
359 | 348 |
360 std::string DataReductionProxyParams::GetDefaultAltOrigin() const { | 349 std::string DataReductionProxyParams::GetDefaultAltOrigin() const { |
361 #if defined(DATA_REDUCTION_PROXY_ALT_ORIGIN) | 350 return "https://proxy.googlezip.net:443/"; |
362 return DATA_REDUCTION_PROXY_ALT_ORIGIN; | |
363 #endif | |
364 return std::string(); | |
365 } | 351 } |
366 | 352 |
367 std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const { | 353 std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const { |
368 #if defined(DATA_REDUCTION_PROXY_ALT_FALLBACK_ORIGIN) | 354 return "http://compress.googlezip.net:80/"; |
369 return DATA_REDUCTION_PROXY_ALT_FALLBACK_ORIGIN; | |
370 #endif | |
371 return std::string(); | |
372 } | 355 } |
373 | 356 |
374 std::string DataReductionProxyParams::GetDefaultProbeURL() const { | 357 std::string DataReductionProxyParams::GetDefaultProbeURL() const { |
375 #if defined(DATA_REDUCTION_PROXY_PROBE_URL) | 358 return "http://check.googlezip.net/connect"; |
376 return DATA_REDUCTION_PROXY_PROBE_URL; | |
377 #endif | |
378 return std::string(); | |
379 } | 359 } |
380 | 360 |
381 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { | 361 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { |
382 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) | 362 return "http://www.gstatic.com/generate_204"; |
383 return DATA_REDUCTION_PROXY_WARMUP_URL; | |
384 #endif | |
385 return std::string(); | |
386 } | 363 } |
387 | 364 |
388 } // namespace data_reduction_proxy | 365 } // namespace data_reduction_proxy |
OLD | NEW |