OLD | NEW |
---|---|
(Empty) | |
1 // Copyright $YEAR 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 <sstream> | |
9 #include <string> | |
10 #include <vector> | |
11 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" | |
12 | |
13 class GURL; | |
14 | |
15 namespace extensions { | |
16 | |
17 class ActivityDatabase; | |
18 | |
19 class FullStreamUIPolicy : public ActivityLogPolicy { | |
Matt Perry
2013/05/30 18:55:32
Add a class comment
dbabic
2013/05/30 21:51:25
Done.
| |
20 public: | |
21 // For more info about these member functions, see the super class. | |
22 explicit FullStreamUIPolicy(Profile* profile, | |
23 content::BrowserThread::ID thread_id); | |
24 | |
25 virtual ~FullStreamUIPolicy(); | |
26 | |
27 virtual void ProcessAction(ActionType action_type, | |
28 const Extension& extension, | |
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 void GetKey(ActivityLogPolicy::KeyType key_id, | |
51 std::string* key_string) const OVERRIDE; | |
52 | |
53 // An error has happened; we want to rollback and close the db. | |
54 // Needs to be public so the error delegate can call it. | |
55 virtual void KillActivityLogDatabase(); | |
56 | |
57 protected: | |
58 // Concatenates arguments efficiently using stringstream | |
59 virtual void ProcessArguments(ActionType action_type, | |
60 const std::string& name, | |
61 const base::ListValue* args, | |
62 std::stringstream& args_string) const; | |
63 | |
64 virtual void ProcessWebRequestModifications( | |
65 base::DictionaryValue& details, | |
66 std::string& details_string) const; | |
67 | |
68 // We initialize this on the same thread as the ActivityLog and policy, but | |
69 // then subsequent operations occur on the DB thread. Instead of destructing | |
70 // the ActivityDatabase, we call its Close() method on the DB thread and it | |
71 // commits suicide. | |
72 ActivityDatabase* db_; | |
73 }; | |
74 | |
75 } // End of the extensions namespace | |
76 | |
77 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | |
OLD | NEW |