Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_ | |
| 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/threading/thread_checker.h" | |
| 14 | |
| 15 namespace data_reduction_proxy { | |
| 16 class DataSavingsRecorder; | |
| 17 class DataSaverStatus; | |
| 18 } | |
| 19 | |
| 20 namespace previews { | |
| 21 | |
| 22 // 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.
| |
| 23 // part of the data savings seen by data saver users. | |
| 24 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
| |
| 25 public: | |
| 26 PreviewsDataSavings( | |
|
bengr
2016/08/25 23:04:19
This needs a comment.
RyanSturm
2016/08/26 17:47:40
Done.
| |
| 27 data_reduction_proxy::DataSavingsRecorder* data_savings_recorder, | |
| 28 data_reduction_proxy::DataSaverStatus* data_reduction_proxy_settings); | |
| 29 ~PreviewsDataSavings(); | |
| 30 | |
| 31 // 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.
| |
| 32 // that would have been used without the preview. |is_update| allows | |
| 33 // 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.
| |
| 34 // 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.
| |
| 35 // codereview.chromium.org). | |
| 36 void RecordDataSavings(const std::string& host, | |
| 37 int64_t data_used, | |
| 38 int64_t original_size); | |
| 39 | |
| 40 private: | |
| 41 // 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.
| |
| 42 // that ultimately owns |this|. | |
| 43 // Provides a method to record data savings. | |
| 44 data_reduction_proxy::DataSavingsRecorder* data_savings_recorder_; | |
| 45 // 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.
| |
| 46 // that ultimately owns |this|. | |
| 47 // Provides a method to determine if data saver is enabled. | |
| 48 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.
| |
| 49 | |
| 50 // Enforce usage on the UI thread. | |
| 51 base::ThreadChecker thread_checker_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(PreviewsDataSavings); | |
| 54 }; | |
| 55 | |
| 56 } // namespace previews | |
| 57 | |
| 58 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_ | |
| OLD | NEW |