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

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

Issue 893003002: Data Reduction Proxy class ownership updates and Settings cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_io_data.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.h" 12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.h"
13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h" 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat istics_prefs.h"
15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h" 15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event _store.h"
16 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
17
18 #if defined(OS_ANDROID)
19 #include "base/android/build_info.h"
20 #endif
16 21
17 namespace content { 22 namespace content {
18 class BrowserContext; 23 class BrowserContext;
19 } 24 }
20 25
26 using data_reduction_proxy::DataReductionProxyParams;
27
21 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> 28 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
22 CreateDataReductionProxyChromeIOData( 29 CreateDataReductionProxyChromeIOData(
23 net::NetLog* net_log, 30 net::NetLog* net_log,
24 content::BrowserContext* browser_context, 31 content::BrowserContext* browser_context,
25 PrefService* prefs, 32 PrefService* prefs,
26 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 33 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
27 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { 34 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) {
28 DCHECK(net_log); 35 DCHECK(net_log);
29 DCHECK(prefs); 36 DCHECK(prefs);
30 DCHECK(browser_context); 37 DCHECK(browser_context);
(...skipping 11 matching lines...) Expand all
42 #else 49 #else
43 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); 50 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
44 #endif 51 #endif
45 52
46 data_reduction_proxy::DataReductionProxyStatisticsPrefs* 53 data_reduction_proxy::DataReductionProxyStatisticsPrefs*
47 data_reduction_proxy_statistics_prefs = 54 data_reduction_proxy_statistics_prefs =
48 new data_reduction_proxy::DataReductionProxyStatisticsPrefs( 55 new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
49 prefs, ui_task_runner, 56 prefs, ui_task_runner,
50 commit_delay); 57 commit_delay);
51 58
59 int flags = DataReductionProxyParams::kAllowed;
60 flags |= DataReductionProxyParams::kFallbackAllowed |
61 DataReductionProxyParams::kAlternativeAllowed;
62 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
63 flags |= DataReductionProxyParams::kPromoAllowed;
64 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial())
65 flags |= DataReductionProxyParams::kHoldback;
66 #if defined(OS_ANDROID)
bengr 2015/02/05 00:46:02 This platform specialization will go away in a fut
jeremyim 2015/02/05 00:59:52 This specialization won't go away, since it's the
bengr 2015/02/05 01:35:11 Fine.
67 if (DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial(
68 base::android::BuildInfo::GetInstance()->android_build_fp())) {
69 flags |= DataReductionProxyParams::kPromoAllowed;
70 }
71 #endif
72
52 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> 73 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
53 data_reduction_proxy_io_data( 74 data_reduction_proxy_io_data(
54 new data_reduction_proxy::DataReductionProxyIOData( 75 new data_reduction_proxy::DataReductionProxyIOData(
55 DataReductionProxyChromeSettings::GetClient(), 76 DataReductionProxyChromeSettings::GetClient(),
77 flags,
56 make_scoped_ptr(data_reduction_proxy_statistics_prefs), 78 make_scoped_ptr(data_reduction_proxy_statistics_prefs),
57 settings, 79 settings,
58 net_log, 80 net_log,
59 io_task_runner, 81 io_task_runner,
60 ui_task_runner)); 82 ui_task_runner));
61 data_reduction_proxy_io_data->InitOnUIThread(prefs); 83 data_reduction_proxy_io_data->InitOnUIThread(prefs);
62 settings->SetDataReductionProxyStatisticsPrefs( 84 settings->SetDataReductionProxyStatisticsPrefs(
63 data_reduction_proxy_statistics_prefs); 85 data_reduction_proxy_statistics_prefs);
64 86
65 return data_reduction_proxy_io_data.Pass(); 87 return data_reduction_proxy_io_data.Pass();
66 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698