Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from willchan and sgurun Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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); 55 int flags = 0;
57 int flags = DataReductionProxyParams::kFallbackAllowed; 56 if (DataReductionProxyParams::IsIncludedInFieldTrial()) {
58 if (DataReductionProxyParams::IsIncludedInFieldTrial()) 57 flags |= (DataReductionProxyParams::kAllowed |
59 flags |= DataReductionProxyParams::kAllowed; 58 DataReductionProxyParams::kFallbackAllowed);
59 }
60 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()) 60 if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
61 flags |= DataReductionProxyParams::kAlternativeAllowed; 61 flags |= DataReductionProxyParams::kAlternativeAllowed;
62 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial()) 62 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
63 flags |= DataReductionProxyParams::kPromoAllowed; 63 flags |= DataReductionProxyParams::kPromoAllowed;
64 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial()) 64 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial())
65 flags |= DataReductionProxyParams::kHoldback; 65 flags |= DataReductionProxyParams::kHoldback;
66 66
67 DataReductionProxyParams* params = new DataReductionProxyParams(flags); 67 return new DataReductionProxyChromeSettings(
68 68 new DataReductionProxyParams(flags));
69 // Takes ownership of params.
70 DataReductionProxyChromeSettings* settings =
71 new DataReductionProxyChromeSettings(params);
72 settings->InitDataReductionProxySettings(profile);
73 return settings;
74 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698