Chromium Code Reviews| 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 9 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag e_stats.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag e_stats.h" |
| 11 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | 11 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" |
| 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | 13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 | 15 |
| 16 #if defined(OS_ANDROID) | |
| 17 #include "base/android/build_info.h" | |
| 18 #endif | |
| 19 | |
| 16 using content::BrowserThread; | 20 using content::BrowserThread; |
| 17 using data_reduction_proxy::DataReductionProxyParams; | 21 using data_reduction_proxy::DataReductionProxyParams; |
| 18 using data_reduction_proxy::DataReductionProxyUsageStats; | 22 using data_reduction_proxy::DataReductionProxyUsageStats; |
| 19 | 23 |
| 20 // static | 24 // static |
| 21 DataReductionProxyChromeSettings* | 25 DataReductionProxyChromeSettings* |
| 22 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 26 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 23 content::BrowserContext* context) { | 27 content::BrowserContext* context) { |
| 24 return static_cast<DataReductionProxyChromeSettings*>( | 28 return static_cast<DataReductionProxyChromeSettings*>( |
| 25 GetInstance()->GetServiceForBrowserContext(context, true)); | 29 GetInstance()->GetServiceForBrowserContext(context, true)); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 52 | 56 |
| 53 KeyedService* DataReductionProxyChromeSettingsFactory::BuildServiceInstanceFor( | 57 KeyedService* DataReductionProxyChromeSettingsFactory::BuildServiceInstanceFor( |
| 54 content::BrowserContext* context) const { | 58 content::BrowserContext* context) const { |
| 55 int flags = DataReductionProxyParams::kAllowed | | 59 int flags = DataReductionProxyParams::kAllowed | |
| 56 DataReductionProxyParams::kFallbackAllowed | | 60 DataReductionProxyParams::kFallbackAllowed | |
| 57 DataReductionProxyParams::kAlternativeAllowed; | 61 DataReductionProxyParams::kAlternativeAllowed; |
| 58 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) | 62 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) |
| 59 flags |= DataReductionProxyParams::kPromoAllowed; | 63 flags |= DataReductionProxyParams::kPromoAllowed; |
| 60 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) | 64 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) |
| 61 flags |= DataReductionProxyParams::kHoldback; | 65 flags |= DataReductionProxyParams::kHoldback; |
| 66 #if defined(OS_ANDROID) | |
| 67 if (DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial( | |
| 68 base::android::BuildInfo::GetInstance()->android_build_fp())) { | |
|
bengr
2015/01/05 18:21:48
indent 4 more
jeremyim
2015/01/05 21:36:05
Done.
| |
| 69 flags |= DataReductionProxyParams::kPromoAllowed; | |
| 70 } | |
| 71 #endif | |
| 62 | 72 |
| 63 return new DataReductionProxyChromeSettings( | 73 return new DataReductionProxyChromeSettings( |
| 64 new DataReductionProxyParams(flags)); | 74 new DataReductionProxyParams(flags)); |
| 65 } | 75 } |
| OLD | NEW |