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

Side by Side Diff: components/previews/previews_data_savings.h

Issue 2257533003: Adding a previews object, PreviewsDataSavings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr comment Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « components/previews/DEPS ('k') | components/previews/previews_data_savings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
18
19 namespace previews {
20
21 // Provides an interface for previews to report data savings.
22 class PreviewsDataSavings {
23 public:
24 // Embedder must guarantee that |data_savings_recorder| and
25 // |data_reduction_proxy_settings| outlive this instance.
26 PreviewsDataSavings(
27 data_reduction_proxy::DataSavingsRecorder* data_savings_recorder);
28 ~PreviewsDataSavings();
29
30 // Records the amount of data used by the preview, and the amount of data
31 // that would have been used if the original page had been loaded instead of
32 // the preview. |fully_qualified_domain_name| is the full host name to
33 // attribute the data savings to (e.g., codereview.chromium.org).
34 void RecordDataSavings(const std::string& fully_qualified_domain_name,
35 int64_t data_used,
36 int64_t original_size);
37
38 private:
39 // Owned by the embedder, must be valid for the lifetime of |this|.
40 // Provides a method to record data savings.
41 data_reduction_proxy::DataSavingsRecorder* data_savings_recorder_;
42
43 // Enforce usage on the UI thread.
44 base::ThreadChecker thread_checker_;
45
46 DISALLOW_COPY_AND_ASSIGN(PreviewsDataSavings);
47 };
48
49 } // namespace previews
50
51 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_DATA_SAVINGS_H_
OLDNEW
« no previous file with comments | « components/previews/DEPS ('k') | components/previews/previews_data_savings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698