[sql] Remove _HAS_EXCEPTIONS=0 from build info.
[chromium-blink-merge.git] / chrome / browser / browsing_data / browsing_data_counter.h
blobbfc0db23d798d74211b8ae21560e91793fda4614
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/prefs/pref_member.h"
12 #include "chrome/browser/profiles/profile.h"
14 class BrowsingDataCounter {
15 public:
16 typedef base::Callback<void(bool, uint32)> Callback;
18 BrowsingDataCounter();
19 virtual ~BrowsingDataCounter();
21 // Should be called once to initialize this class.
22 void Init(Profile* profile,
23 const Callback& callback);
25 // Name of the preference associated with this counter.
26 virtual const std::string& GetPrefName() const = 0;
28 protected:
29 // Should be called from |Count| by any overriding class to indicate that
30 // counting is finished and report the |result|.
31 void ReportResult(uint32 result);
33 private:
34 // Called when the boolean preference indicating whether this data type
35 // is to be deleted changes.
36 void OnPrefChanged();
38 // Count the data.
39 virtual void Count();
41 // The profile for which we will count the data volume.
42 Profile* profile_;
44 // The callback that will be called when the UI should be updated with a new
45 // counter value.
46 Callback callback_;
48 // The boolean preference indicating whether this data type is to be deleted.
49 // If false, we will not count it.
50 BooleanPrefMember pref_;
52 // Whether this counter is currently in the process of counting.
53 bool counting_;
55 // Whether this class was properly initialized by calling |Init|.
56 bool initialized_;
59 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_