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

Unified Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.cc

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.cc
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1cda25929df402c54ec9a5d5aef50fa64cb35464
--- /dev/null
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.cc
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.h"
+#include "base/memory/singleton.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+
+// static
+DataReductionProxySettingsAndroid*
+DataReductionProxySettingsFactoryAndroid::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<DataReductionProxySettingsAndroid*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+bool DataReductionProxySettingsFactoryAndroid::
+HasDataReductionProxySettingsAndroid(
+ content::BrowserContext* context) {
+ return GetInstance()->GetServiceForBrowserContext(context, false) != NULL;
+}
+
+// static
+DataReductionProxySettingsFactoryAndroid*
+DataReductionProxySettingsFactoryAndroid::GetInstance() {
+ return Singleton<DataReductionProxySettingsFactoryAndroid>::get();
+}
+
+
+DataReductionProxySettingsFactoryAndroid::
+DataReductionProxySettingsFactoryAndroid()
+ : BrowserContextKeyedServiceFactory(
+ "ProfileSyncService",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+
+DataReductionProxySettingsFactoryAndroid::
+~DataReductionProxySettingsFactoryAndroid() {
+}
+
+KeyedService* DataReductionProxySettingsFactoryAndroid::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = static_cast<Profile*>(context);
+ int flags = DataReductionProxyParams::kFallbackAllowed;
+ if (DataReductionProxyParams::IsIncludedInFieldTrial())
+ flags |= DataReductionProxyParams::kAllowed;
+ if (DataReductionProxyParams::IsIncludedInAlternativeFieldTrial())
+ flags |= DataReductionProxyParams::kAlternativeAllowed;
+ if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
+ flags |= DataReductionProxyParams::kPromoAllowed;
+
+ DataReductionProxySettingsAndroid* settings =
+ new DataReductionProxySettingsAndroid(
+ new DataReductionProxyParams(flags));
+ settings->InitDataReductionProxySettings(profile);
+ return settings;
+}
+

Powered by Google App Engine
This is Rietveld 408576698