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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service.h

Issue 792803007: Make Data Reduction Proxy a best effort proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated tests Created 5 years, 11 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service.h
deleted file mode 100644
index 49e56c4d1f20d2d68d7bd11f8252e599cc738940..0000000000000000000000000000000000000000
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// 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.
-
-#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERVICE_H_
-#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERVICE_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/gtest_prod_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/observer_list.h"
-#include "base/task_runner.h"
-#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
-#include "net/proxy/proxy_config.h"
-#include "net/proxy/proxy_config_service.h"
-
-class PrefService;
-
-namespace net {
-class ProxyConfig;
-}
-
-namespace data_reduction_proxy {
-
-// A net::ProxyConfigService implementation that applies data reduction proxy
-// settings as overrides to the proxy configuration determined by a
-// baseline delegate ProxyConfigService.
-class DataReductionProxyConfigService
- : public net::ProxyConfigService,
- public net::ProxyConfigService::Observer {
- public:
- // Takes ownership of the passed |base_service|.
- DataReductionProxyConfigService(
- scoped_ptr<net::ProxyConfigService> base_service);
- ~DataReductionProxyConfigService() override;
-
- // ProxyConfigService implementation:
- void AddObserver(net::ProxyConfigService::Observer* observer) override;
- void RemoveObserver(net::ProxyConfigService::Observer* observer) override;
- ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* config) override;
- void OnLazyPoll() override;
-
- // Method on IO thread that receives the data reduction proxy settings pushed
- // from DataReductionProxyConfiguratorImpl.
- void UpdateProxyConfig(bool enabled,
- const net::ProxyConfig& config);
-
- private:
- friend class DataReductionProxyConfigServiceTest;
-
- // ProxyConfigService::Observer implementation:
- void OnProxyConfigChanged(const net::ProxyConfig& config,
- ConfigAvailability availability) override;
-
- // Makes sure that the observer registration with the base service is set up.
- void RegisterObserver();
-
- scoped_ptr<net::ProxyConfigService> base_service_;
- ObserverList<net::ProxyConfigService::Observer, true> observers_;
-
- // Configuration as defined by the data reduction proxy.
- net::ProxyConfig config_;
-
- // Flag that indicates that a PrefProxyConfigTracker needs to inform us
- // about a proxy configuration before we may return any configuration.
- bool config_read_pending_;
-
- // Indicates whether the base service registration is done.
- bool registered_observer_;
-
- // The data reduction proxy is enabled.
- bool enabled_;
-
- // Use of the data reduction proxy is restricted to HTTP proxying only.
- bool restricted_;
-
- DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfigService);
-};
-
-// A data_reduction_proxy::DataReductionProxyConfigurator implementation that
-// tracks changes to the data reduction proxy configuration and notifies an
-// associated DataReductionProxyConfigService. Configuration changes include
-// adding URL and host patterns to bypass and enabling and disabling use of the
-// proxy.
-class DataReductionProxyConfigTracker : public DataReductionProxyConfigurator {
- public:
- DataReductionProxyConfigTracker(
- base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config,
- const scoped_refptr<base::TaskRunner>& task_runner);
- ~DataReductionProxyConfigTracker() override;
-
- void Enable(bool primary_restricted,
- bool fallback_restricted,
- const std::string& primary_origin,
- const std::string& fallback_origin,
- const std::string& ssl_origin) override;
- void Disable() override;
- void AddHostPatternToBypass(const std::string& pattern) override;
- void AddURLPatternToBypass(const std::string& pattern) override;
-
- private:
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest,
- TrackerEnable);
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest,
- TrackerRestricted);
- FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest,
- TrackerBypassList);
-
- void UpdateProxyConfigOnIOThread(bool enabled,
- const net::ProxyConfig& config);
-
- base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config_;
- std::vector<std::string> bypass_rules_;
- scoped_refptr<base::TaskRunner> task_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfigTracker);
-};
-
-} // namespace data_reduction_proxy
-
-#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698