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 "chrome/browser/profiles/profile.h" | |
11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 10 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
12 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" | 11 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" |
13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
14 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | 13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" |
15 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
16 | 15 |
17 using content::BrowserThread; | 16 using content::BrowserThread; |
18 using data_reduction_proxy::DataReductionProxyParams; | 17 using data_reduction_proxy::DataReductionProxyParams; |
19 using data_reduction_proxy::DataReductionProxyUsageStats; | 18 using data_reduction_proxy::DataReductionProxyUsageStats; |
20 | 19 |
(...skipping 25 matching lines...) Expand all Loading... | |
46 "DataReductionProxyChromeSettings", | 45 "DataReductionProxyChromeSettings", |
47 BrowserContextDependencyManager::GetInstance()) { | 46 BrowserContextDependencyManager::GetInstance()) { |
48 } | 47 } |
49 | 48 |
50 DataReductionProxyChromeSettingsFactory:: | 49 DataReductionProxyChromeSettingsFactory:: |
51 ~DataReductionProxyChromeSettingsFactory() { | 50 ~DataReductionProxyChromeSettingsFactory() { |
52 } | 51 } |
53 | 52 |
54 KeyedService* DataReductionProxyChromeSettingsFactory::BuildServiceInstanceFor( | 53 KeyedService* DataReductionProxyChromeSettingsFactory::BuildServiceInstanceFor( |
55 content::BrowserContext* context) const { | 54 content::BrowserContext* context) const { |
56 Profile* profile = static_cast<Profile*>(context); | |
57 int flags = DataReductionProxyParams::kFallbackAllowed; | 55 int flags = DataReductionProxyParams::kFallbackAllowed; |
58 if (DataReductionProxyParams::IsIncludedInFieldTrial()) | 56 if (DataReductionProxyParams::IsIncludedInFieldTrial()) |
59 flags |= DataReductionProxyParams::kAllowed; | 57 flags |= DataReductionProxyParams::kAllowed; |
60 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) | 58 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) |
61 flags |= DataReductionProxyParams::kAlternativeAllowed; | 59 flags |= DataReductionProxyParams::kAlternativeAllowed; |
62 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) | 60 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) |
63 flags |= DataReductionProxyParams::kPromoAllowed; | 61 flags |= DataReductionProxyParams::kPromoAllowed; |
64 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) | 62 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) |
65 flags |= DataReductionProxyParams::kHoldback; | 63 flags |= DataReductionProxyParams::kHoldback; |
66 | 64 |
67 DataReductionProxyParams* params = new DataReductionProxyParams(flags); | 65 DataReductionProxyParams* params = new DataReductionProxyParams(flags); |
68 | 66 |
69 // Takes ownership of params. | 67 // Takes ownership of params. |
willchan no longer on Chromium
2014/07/29 00:26:56
You don't have to fix this, but you could get rid
bengr
2014/07/29 21:29:52
I won't fix this in this CL, but I tightened the c
| |
70 DataReductionProxyChromeSettings* settings = | 68 return new DataReductionProxyChromeSettings(params); |
71 new DataReductionProxyChromeSettings(params); | |
72 settings->InitDataReductionProxySettings(profile); | |
73 return settings; | |
74 } | 69 } |
OLD | NEW |