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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_policy.cc

Issue 15573003: New architecture of the activity logging: Policies for summarization (and compression) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compiler errors on different platforms (at least I hope so). Created 7 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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.
4
5 #include <stdint.h>
6
7 #include "chrome/browser/extensions/activity_log/activity_log_policy.h"
8 #include "base/logging.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/extension.h"
11 #include "googleurl/src/gurl.h"
12
13 using namespace base;
14
15 namespace extensions {
16
17 ActivityLogPolicy::ActivityLogPolicy(Profile* profile)
18 : last_sync_timestamp_(Time::Now()), sync_on_request_only_(false) {
19
20 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
21 profile_base_path_ = profile->GetPath();
22 }
23
24 void ActivityLogPolicy::ProcessAction(
25 ActionType action_ty,
felt 2013/05/22 21:17:59 this can be action_type.
dbabic 2013/05/23 01:35:04 Done.
26 const Extension& extension,
27 const std::string& name,
28 const GURL* url,
29 const ListValue* arguments,
30 const DictionaryValue* details) {
31
felt 2013/05/22 21:17:59 Remove blank lines at beginning of methods, for th
dbabic 2013/05/23 01:35:04 Done.
32 DoProcessAction(action_ty, extension, name, url, arguments, details);
33
34 // 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.
35 const int64_t sync_period_in_mins = 5;
36 if (!sync_on_request_only_) {
37 Time now = Time::Now();
38 if (now - last_sync_timestamp_ >=
39 TimeDelta::FromMinutes(sync_period_in_mins)) {
40 SaveState();
41 last_sync_timestamp_ = now;
42 }
43 }
44 }
45
46 void ActivityLogPolicy::GetKey(KeyType, std::string& key) const {
47 key = "";
48 }
49
50 } // End of the extensions namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698