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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_counter.h

Issue 1342093003: Decouple the browsing data counters initialization and start. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added Restart() to tests as well. Created 5 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 | « no previous file | chrome/browser/browsing_data/browsing_data_counter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 11 matching lines...) Expand all
22 // Should be called once to initialize this class. 22 // Should be called once to initialize this class.
23 void Init(Profile* profile, 23 void Init(Profile* profile,
24 const Callback& callback); 24 const Callback& callback);
25 25
26 // Name of the preference associated with this counter. 26 // Name of the preference associated with this counter.
27 virtual const std::string& GetPrefName() const = 0; 27 virtual const std::string& GetPrefName() const = 0;
28 28
29 // The profile associated with this counter. 29 // The profile associated with this counter.
30 Profile* GetProfile() const; 30 Profile* GetProfile() const;
31 31
32 // Restarts the counter. Will be called automatically if the counting needs
33 // to be restarted, e.g. when the deletion preference changes state or when
34 // we are notified of data changes.
35 void Restart();
36
32 protected: 37 protected:
33 // Called when some conditions have changed and the counting should be
34 // restarted, e.g. when the deletion preference changed state or when
35 // we were notified of data changes.
36 void RestartCounting();
37
38 // Should be called from |Count| by any overriding class to indicate that 38 // Should be called from |Count| by any overriding class to indicate that
39 // counting is finished and report the |result|. 39 // counting is finished and report the |result|.
40 void ReportResult(uint32 result); 40 void ReportResult(uint32 result);
41 41
42 // Calculates the beginning of the counting period as |period_| before now. 42 // Calculates the beginning of the counting period as |period_| before now.
43 base::Time GetPeriodStart(); 43 base::Time GetPeriodStart();
44 44
45 private: 45 private:
46 // Called after the class is initialized by calling |Init|. 46 // Called after the class is initialized by calling |Init|.
47 virtual void OnInitialized(); 47 virtual void OnInitialized();
(...skipping 14 matching lines...) Expand all
62 62
63 // The integer preference describing the time period for which this data type 63 // The integer preference describing the time period for which this data type
64 // is to be deleted. 64 // is to be deleted.
65 IntegerPrefMember period_; 65 IntegerPrefMember period_;
66 66
67 // Whether this class was properly initialized by calling |Init|. 67 // Whether this class was properly initialized by calling |Init|.
68 bool initialized_ = false; 68 bool initialized_ = false;
69 }; 69 };
70 70
71 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_ 71 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698