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

Side by Side Diff: chrome/browser/extensions/activity_log/fullstream_ui_policy.h

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 browser test. Created 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 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 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_
7
8 #include <string>
9 #include <vector>
10 #include "chrome/browser/extensions/activity_log/activity_log_policy.h"
11
12 class GURL;
13
14 namespace extensions {
15
16 class ActivityDatabase;
17
18 // A policy for logging the full stream of actions, including all arguments.
19 // It's mostly intended to be used in testing and analysis.
20 class FullStreamUIPolicy : public ActivityLogPolicy {
21 public:
22 // For more info about these member functions, see the super class.
23 explicit FullStreamUIPolicy(Profile* profile);
24
25 virtual ~FullStreamUIPolicy();
26
27 virtual void ProcessAction(ActionType action_type,
28 const std::string& extension_id,
29 const std::string& name, const GURL& gurl,
30 const base::ListValue* args,
31 const base::DictionaryValue* details) OVERRIDE;
32
33 virtual void SaveState() OVERRIDE {}
34
35 // TODO(felt,dbabic) This is overly specific to FullStreamUIPolicy.
36 // It assumes that the callback can return a sorted vector of actions. Some
37 // policies might not do that. For instance, imagine a trivial policy that
38 // just counts the frequency of certain actions within some time period,
39 // this call would be meaningless, as it couldn't return anything useful.
40 virtual void ReadData(
41 const std::string& extension_id,
42 const int day,
43 const base::Callback
44 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback)
45 const OVERRIDE;
46
47 virtual void SetSaveStateOnRequestOnly() OVERRIDE;
48
49 // Returns the actual key for a given key type
50 virtual std::string GetKey(ActivityLogPolicy::KeyType key_id) const OVERRIDE;
51
52 protected:
53 // Concatenates arguments
54 virtual std::string ProcessArguments(ActionType action_type,
55 const std::string& name,
56 const base::ListValue* args) const;
57
58 virtual void ProcessWebRequestModifications(
59 base::DictionaryValue& details,
60 std::string& details_string) const;
61
62 // We initialize this on the same thread as the ActivityLog and policy, but
63 // then subsequent operations occur on the DB thread. Instead of destructing
64 // the ActivityDatabase, we call its Close() method on the DB thread and it
65 // commits suicide.
66 ActivityDatabase* db_;
67 };
68
69 } // namespace extensions
70
71 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698