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 <string> | |
9 #include <sstream> | |
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 class FullStreamUIPolicy : public ActivityLogPolicy { | |
19 public: | |
felt
2013/05/24 18:43:38
"public:" should be indented 1 space, and all the
dbabic
2013/05/29 18:41:40
Done.
| |
20 | |
felt
2013/05/24 18:43:38
no vspace between "public" and comment
dbabic
2013/05/29 18:41:40
Done.
| |
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<void( | |
44 scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) | |
45 const OVERRIDE; | |
46 | |
47 // Returns the actual key for a given key type | |
48 virtual void GetKey(ActivityLogPolicy::KeyType key_id, | |
49 std::string& key_string) const OVERRIDE; | |
50 | |
51 // An error has happened; we want to rollback and close the db. | |
52 // Needs to be public so the error delegate can call it. | |
53 virtual void KillActivityLogDatabase(); | |
54 | |
55 protected: | |
56 // Concatenates arguments efficiently using stringstream | |
57 virtual void ProcessArguments(ActionType action_type, | |
58 const std::string& name, | |
59 const base::ListValue* args, | |
60 std::stringstream& args_string) const; | |
61 | |
62 virtual void ProcessWebRequestModifications( | |
63 base::DictionaryValue& details, | |
64 std::string& details_string) const; | |
65 | |
66 // We initialize this on the same thread as the ActivityLog, but then | |
felt
2013/05/24 18:43:38
"ActivityLog and policy, but then"
dbabic
2013/05/29 18:41:40
Done.
| |
67 // subsequent operations occur on the DB thread. Instead of destructing the | |
68 // ActivityDatabase, we call its Close() method on the DB thread and it | |
69 // commits suicide. | |
70 ActivityDatabase* db_; | |
71 }; | |
72 | |
73 } // End of the extensions namespace | |
74 | |
75 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ | |
OLD | NEW |