Chromium Code Reviews| Index: components/previews/previews_data_savings.h |
| diff --git a/components/previews/previews_data_savings.h b/components/previews/previews_data_savings.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f28d6ccb5661cd7ddedfe8a3229158086671265d |
| --- /dev/null |
| +++ b/components/previews/previews_data_savings.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 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 CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_ |
| +#define CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "base/threading/thread_checker.h" |
| + |
| +namespace data_reduction_proxy { |
| +class DataSavingsRecorder; |
| +class DataSaverStatus; |
| +} |
| + |
| +namespace previews { |
| + |
| +// Provides an interface for previews/ to record data savings and report is as |
|
bengr
2016/08/25 23:04:19
This class shouldn't care how it is going to be us
RyanSturm
2016/08/26 17:47:40
Done.
|
| +// part of the data savings seen by data saver users. |
| +class PreviewsDataSavings { |
|
Not at Google. Contact bengr
2016/08/25 19:24:48
Would it make sense for PreviewsDataSavings to be
RyanSturm
2016/08/25 20:22:45
DataReductionProxy shouldn't know anything about p
Not at Google. Contact bengr
2016/08/26 00:36:10
How will this class be initialized and hooked up?
RyanSturm
2016/08/26 17:47:39
Still not finalized; here is a CL with a possibili
|
| + public: |
| + PreviewsDataSavings( |
|
bengr
2016/08/25 23:04:19
This needs a comment.
RyanSturm
2016/08/26 17:47:40
Done.
|
| + data_reduction_proxy::DataSavingsRecorder* data_savings_recorder, |
| + data_reduction_proxy::DataSaverStatus* data_reduction_proxy_settings); |
| + ~PreviewsDataSavings(); |
| + |
| + // Records the amount of data used by that preview, and the amount of data |
|
bengr
2016/08/25 23:04:19
that -> the
without -> if the original page had be
RyanSturm
2016/08/26 17:47:39
Done.
|
| + // that would have been used without the preview. |is_update| allows |
| + // adjustment to previosuly recorded data (all URLRequest data_used is |
|
bengr
2016/08/25 23:04:19
previously
Also, what does "adjustment" mean in t
RyanSturm
2016/08/26 17:47:40
It's not, done.
|
| + // tracked). |host| is the host name to attribute the data savings to (e.g. |
|
bengr
2016/08/25 23:04:19
Is host the right term? FQDM might be better.
RyanSturm
2016/08/26 17:47:39
Done.
|
| + // codereview.chromium.org). |
| + void RecordDataSavings(const std::string& host, |
| + int64_t data_used, |
| + int64_t original_size); |
| + |
| + private: |
| + // Owned by DataReductionProxyService, which will outlive the WebContents |
|
bengr
2016/08/25 23:04:19
This interface shouldn't know anything about its e
RyanSturm
2016/08/26 17:47:40
Done.
|
| + // that ultimately owns |this|. |
| + // Provides a method to record data savings. |
| + data_reduction_proxy::DataSavingsRecorder* data_savings_recorder_; |
| + // Owned by DataReductionProxyService, which will outlive the WebContents |
|
bengr
2016/08/25 23:04:19
Here too.
RyanSturm
2016/08/26 17:47:39
Done.
|
| + // that ultimately owns |this|. |
| + // Provides a method to determine if data saver is enabled. |
| + data_reduction_proxy::DataSaverStatus* data_saver_status_; |
|
bengr
2016/08/25 23:04:19
It might be better to store a callback instead of
RyanSturm
2016/08/26 17:47:40
See other comment.
|
| + |
| + // Enforce usage on the UI thread. |
| + base::ThreadChecker thread_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PreviewsDataSavings); |
| +}; |
| + |
| +} // namespace previews |
| + |
| +#endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_ |