Chromium Code Reviews| Index: components/metrics/metrics_reporting_scheduler.h |
| diff --git a/components/metrics/metrics_reporting_scheduler.h b/components/metrics/metrics_reporting_scheduler.h |
| index 19f07570663727eb2c8c259b91fb073fd0477e8d..9053ba51bf61168d2765a43bd05bed0a36018c8c 100644 |
| --- a/components/metrics/metrics_reporting_scheduler.h |
| +++ b/components/metrics/metrics_reporting_scheduler.h |
| @@ -10,13 +10,16 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/time/time.h" |
| #include "base/timer/timer.h" |
| +#include "components/metrics/net/network_metrics_provider.h" |
| namespace metrics { |
| // Scheduler task to drive a MetricsService object's uploading. |
| class MetricsReportingScheduler { |
| public: |
| - explicit MetricsReportingScheduler(const base::Closure& upload_callback); |
| + explicit MetricsReportingScheduler( |
|
Alexei Svitkine (slow)
2015/02/17 20:50:04
Nit: Remove explicit since there's two params. Add
gayane -on leave until 09-2017
2015/02/18 00:30:35
Done.
|
| + const base::Closure& upload_callback, |
| + const base::Closure& is_cellular_connection_func); |
|
Alexei Svitkine (slow)
2015/02/17 20:50:04
Nit: func -> callback
gayane -on leave until 09-2017
2015/02/18 00:30:35
Done.
|
| ~MetricsReportingScheduler(); |
| // Starts scheduling uploads. This in a no-op if the scheduler is already |
| @@ -39,6 +42,9 @@ class MetricsReportingScheduler { |
| // Sets the upload interval to a specific value, exposed for unit tests. |
| void SetUploadIntervalForTesting(base::TimeDelta interval); |
| + // Sets whether the network connection is cellular or not. |
| + void SetConnectionType(bool is_cellular); |
| + |
| private: |
| // Timer callback indicating it's time for the MetricsService to upload |
| // metrics. |
| @@ -57,6 +63,10 @@ class MetricsReportingScheduler { |
| // (bug: 17391128). Should be removed once the experiments are done. |
| base::TimeDelta GetStandardUploadInterval(); |
| + // Returns true if the user is assigned to the experiment group for enabled |
| + // cellular uploads. |
| + bool IsCellularEnabledByExperiment(); |
| + |
| // The MetricsService method to call when uploading should happen. |
| const base::Closure upload_callback_; |
| @@ -84,6 +94,13 @@ class MetricsReportingScheduler { |
| // has been completed. |
| bool waiting_for_init_task_complete_; |
| + // Pointer to |MetricsServcie::IsCellularConnection| function. |
|
Alexei Svitkine (slow)
2015/02/17 20:50:04
Can you explain instead what the callback does?
gayane -on leave until 09-2017
2015/02/18 00:30:35
Done.
|
| + base::Closure update_connection_type_func_; |
| + |
| + // Indicates whether network connection is cellular or not. |
| + // Default value is |true| because cellular mode is more conservative. |
| + bool is_cellular_connection_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(MetricsReportingScheduler); |
| }; |