Index: chrome/browser/extensions/activity_log/activity_log_policy.cc |
diff --git a/chrome/browser/extensions/activity_log/activity_log_policy.cc b/chrome/browser/extensions/activity_log/activity_log_policy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8689a36fa079ae98ff8acad627a200afdcecc49d |
--- /dev/null |
+++ b/chrome/browser/extensions/activity_log/activity_log_policy.cc |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <stdint.h> |
+ |
+#include "chrome/browser/extensions/activity_log/activity_log_policy.h" |
+#include "base/logging.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/extensions/extension.h" |
+#include "googleurl/src/gurl.h" |
+ |
+using namespace base; |
+ |
+namespace extensions { |
+ |
+ActivityLogPolicy::ActivityLogPolicy(Profile* profile) |
+ : last_sync_timestamp_(Time::Now()), sync_on_request_only_(false) { |
+ |
+ CHECK(profile && "Null ptr dereference"); |
felt
2013/05/22 21:17:59
Always use DCHECK -- DCHECK will crash in debug mo
dbabic
2013/05/23 01:35:04
It's usually good to check for things that would c
felt
2013/05/23 04:20:01
Other reviewers have heckled me for this in the pa
|
+ profile_base_path_ = profile->GetPath(); |
+} |
+ |
+void ActivityLogPolicy::ProcessAction( |
+ ActionType action_ty, |
felt
2013/05/22 21:17:59
this can be action_type.
dbabic
2013/05/23 01:35:04
Done.
|
+ const Extension& extension, |
+ const std::string& name, |
+ const GURL* url, |
+ const ListValue* arguments, |
+ const DictionaryValue* details) { |
+ |
felt
2013/05/22 21:17:59
Remove blank lines at beginning of methods, for th
dbabic
2013/05/23 01:35:04
Done.
|
+ DoProcessAction(action_ty, extension, name, url, arguments, details); |
+ |
+ // Check timestamp and save state if needed |
felt
2013/05/22 21:17:59
Please revert to using the timer that flushes on d
dbabic
2013/05/23 01:35:04
Could you suggest the class I should use?
felt
2013/05/23 04:20:01
Yes, copy how it was implemented in activity_datab
dbabic
2013/05/24 00:35:07
Done.
|
+ const int64_t sync_period_in_mins = 5; |
+ if (!sync_on_request_only_) { |
+ Time now = Time::Now(); |
+ if (now - last_sync_timestamp_ >= |
+ TimeDelta::FromMinutes(sync_period_in_mins)) { |
+ SaveState(); |
+ last_sync_timestamp_ = now; |
+ } |
+ } |
+} |
+ |
+void ActivityLogPolicy::GetKey(KeyType, std::string& key) const { |
+ key = ""; |
+} |
+ |
+} // End of the extensions namespace |