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

Unified Diff: components/browsing_data/counters/browsing_data_counter.h

Issue 2084903002: Moved BrowsingDataCounter and part of BrowsingDataCounterUtils to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed deps Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/browsing_data/counters/browsing_data_counter.h
diff --git a/chrome/browser/browsing_data/browsing_data_counter.h b/components/browsing_data/counters/browsing_data_counter.h
similarity index 77%
rename from chrome/browser/browsing_data/browsing_data_counter.h
rename to components/browsing_data/counters/browsing_data_counter.h
index 3bd1e4b97448825bd09b979d3074632802f1f14a..954078315d7775936abd181722ffb1bdeb2dca34 100644
--- a/chrome/browser/browsing_data/browsing_data_counter.h
+++ b/components/browsing_data/counters/browsing_data_counter.h
@@ -1,18 +1,17 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
msramek 2016/06/21 14:43:56 I think you can keep the year, as the class was wr
ioanap 2016/06/23 14:56:27 Done.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
-#define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
+#ifndef COMPONENTS_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_H_
+#define COMPONENTS_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_H_
#include <stdint.h>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "chrome/browser/browsing_data/browsing_data_remover.h"
-#include "chrome/browser/profiles/profile.h"
#include "components/prefs/pref_member.h"
+#include "components/prefs/pref_service.h"
msramek 2016/06/21 14:43:56 Prefer forward declarations before includes in .h
ioanap 2016/06/23 14:56:27 Done.
msramek 2016/06/21 14:43:56 In //chrome/browser, we usually don't use namespac
ioanap 2016/06/23 14:56:27 Done.
class BrowsingDataCounter {
public:
@@ -56,18 +55,20 @@ class BrowsingDataCounter {
typedef base::Callback<void(std::unique_ptr<Result>)> Callback;
- BrowsingDataCounter();
+ BrowsingDataCounter(const std::string& pref_name);
virtual ~BrowsingDataCounter();
// Should be called once to initialize this class.
- void Init(Profile* profile,
+ void Init(PrefService* pref_service,
+ const std::string& delete_time_period_pref,
msramek 2016/06/21 14:43:56 This should ideally also be defined in the compone
ioanap 2016/06/23 14:56:27 Done.
const Callback& callback);
// Name of the preference associated with this counter.
- virtual const std::string& GetPrefName() const = 0;
+ const std::string& GetPrefName() const;
- // The profile associated with this counter.
- Profile* GetProfile() const;
+ // PrefService that manages the preferences for the user profile
+ // associated with this counter.
+ PrefService* GetPrefs() const;
// Restarts the counter. Will be called automatically if the counting needs
// to be restarted, e.g. when the deletion preference changes state or when
@@ -93,8 +94,12 @@ class BrowsingDataCounter {
// Count the data.
virtual void Count() = 0;
- // The profile for which we will count the data volume.
- Profile* profile_;
+ // Name of the preference associated with this counter.
+ const std::string pref_name_;
+
+ // Pointer to the PrefService that manages the preferences for the user
+ // profile associated with this counter.
+ PrefService* pref_service_;
// The callback that will be called when the UI should be updated with a new
// counter value.
@@ -112,4 +117,4 @@ class BrowsingDataCounter {
bool initialized_ = false;
};
-#endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_H_
+#endif // COMPONENTS_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_H_

Powered by Google App Engine
This is Rietveld 408576698