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

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

Issue 778463002: Wrapped data reduction proxy initialization into its own class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@network-delegate
Patch Set: Addressed comment from mmenke Created 6 years 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_usage_stats.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h
index fbcbeb15a4695ed908ae5251f91fb98c3b975e6a..0240df7d596cdf1df980447bbb5571aac25a3ed4 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h
@@ -6,8 +6,8 @@
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS_H_
#include "base/callback.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "base/prefs/pref_member.h"
+#include "base/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
@@ -23,6 +23,8 @@ class ProxyServer;
namespace data_reduction_proxy {
+class DataReductionProxySettings;
+
class DataReductionProxyUsageStats
: public net::NetworkChangeNotifier::NetworkChangeObserver {
public:
@@ -46,16 +48,10 @@ class DataReductionProxyUsageStats
// this class instance.
DataReductionProxyUsageStats(
DataReductionProxyParams* params,
- const scoped_refptr<base::MessageLoopProxy>& ui_thread_proxy);
+ DataReductionProxySettings* settings,
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner);
~DataReductionProxyUsageStats() override;
- // Sets the callback to be called on the UI thread when the unavailability
- // status has changed.
- void set_unavailable_callback(
- const base::Callback<void(bool)>& unavailable_callback) {
- unavailable_callback_ = unavailable_callback;
- }
-
// Callback intended to be called from |ChromeNetworkDelegate| when a
// request completes. This method is used to gather usage stats.
void OnUrlRequestCompleted(const net::URLRequest* request, bool started);
@@ -135,12 +131,15 @@ class DataReductionProxyUsageStats
void NotifyUnavailabilityOnUIThread(bool unavailable);
DataReductionProxyParams* data_reduction_proxy_params_;
+
+ DataReductionProxySettings* settings_;
+
// The last reason for bypass as determined by
// MaybeBypassProxyAndPrepareToRetry
DataReductionProxyBypassType last_bypass_type_;
// True if the last request triggered the current bypass.
bool triggering_request_;
- const scoped_refptr<base::MessageLoopProxy> ui_thread_proxy_;
+ const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
// The following 2 fields are used to determine if data reduction proxy is
// unreachable. We keep a count of requests which should go through
@@ -165,9 +164,6 @@ class DataReductionProxyUsageStats
BypassedBytesType bypassed_bytes_type,
int64 content_length);
- // Called when the unavailability status has changed. Runs on the UI thread.
- base::Callback<void(bool)> unavailable_callback_;
-
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats);
};

Powered by Google App Engine
This is Rietveld 408576698