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

Unified Diff: chrome/browser/extensions/api/alarms/alarm_manager.h

Issue 12314056: Make chrome/browser/extensions use base::Clock instead of MockTimeProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add include Created 7 years, 10 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
« no previous file with comments | « base/test/simple_test_tick_clock.h ('k') | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/alarms/alarm_manager.h
diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.h b/chrome/browser/extensions/api/alarms/alarm_manager.h
index 0854a041c7a5ed45063657374a69c4ae2f20e0dc..0e2bd002d4f80aabf1d290c5105aa0c91ce11c1d 100644
--- a/chrome/browser/extensions/api/alarms/alarm_manager.h
+++ b/chrome/browser/extensions/api/alarms/alarm_manager.h
@@ -18,18 +18,20 @@
class Profile;
+namespace base {
+class Clock;
+} // namespace base
+
namespace extensions {
class ExtensionAlarmsSchedulingTest;
struct Alarm {
- typedef base::Time (*TimeProvider)();
-
Alarm();
Alarm(const std::string& name,
const api::alarms::AlarmCreateInfo& create_info,
base::TimeDelta min_granularity,
- TimeProvider now);
+ base::Time now);
~Alarm();
linked_ptr<api::alarms::Alarm> js_alarm;
@@ -47,7 +49,6 @@ class AlarmManager
: public content::NotificationObserver,
public base::SupportsWeakPtr<AlarmManager> {
public:
- typedef base::Time (*TimeProvider)();
typedef std::vector<Alarm> AlarmList;
class Delegate {
@@ -58,8 +59,9 @@ class AlarmManager
const Alarm& alarm) = 0;
};
- // 'now' is usually &base::Time::Now.
- explicit AlarmManager(Profile* profile, TimeProvider now);
+ // |clock| is usually a base::DefaultClock, but can be something
+ // else for testing.
+ explicit AlarmManager(Profile* profile, base::Clock* clock);
virtual ~AlarmManager();
// Override the default delegate. Callee assumes onwership. Used for testing.
@@ -135,8 +137,8 @@ class AlarmManager
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- Profile* profile_;
- const TimeProvider now_;
+ Profile* const profile_;
+ base::Clock* const clock_;
content::NotificationRegistrar registrar_;
scoped_ptr<Delegate> delegate_;
« no previous file with comments | « base/test/simple_test_tick_clock.h ('k') | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698