OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 // Observers can listen for activity events. There is probably only one | 47 // Observers can listen for activity events. There is probably only one |
48 // observer: the activityLogPrivate API. | 48 // observer: the activityLogPrivate API. |
49 class Observer { | 49 class Observer { |
50 public: | 50 public: |
51 virtual void OnExtensionActivity(scoped_refptr<Action> activity) = 0; | 51 virtual void OnExtensionActivity(scoped_refptr<Action> activity) = 0; |
52 }; | 52 }; |
53 | 53 |
54 static BrowserContextKeyedAPIFactory<ActivityLog>* GetFactoryInstance(); | 54 static BrowserContextKeyedAPIFactory<ActivityLog>* GetFactoryInstance(); |
55 | 55 |
56 // ActivityLog is a BrowserContextKeyedService, so don't instantiate it with | 56 // ActivityLog is a KeyedService, so don't instantiate it with |
57 // the constructor; use GetInstance instead. | 57 // the constructor; use GetInstance instead. |
58 static ActivityLog* GetInstance(content::BrowserContext* context); | 58 static ActivityLog* GetInstance(content::BrowserContext* context); |
59 | 59 |
60 // Add/remove observer: the activityLogPrivate API only listens when the | 60 // Add/remove observer: the activityLogPrivate API only listens when the |
61 // ActivityLog extension is registered for an event. | 61 // ActivityLog extension is registered for an event. |
62 void AddObserver(Observer* observer); | 62 void AddObserver(Observer* observer); |
63 void RemoveObserver(Observer* observer); | 63 void RemoveObserver(Observer* observer); |
64 | 64 |
65 // Logs an extension action: passes it to any installed policy to be logged | 65 // Logs an extension action: passes it to any installed policy to be logged |
66 // to the database, to any observers, and logs to the console if in testing | 66 // to the database, to any observers, and logs to the console if in testing |
(...skipping 24 matching lines...) Expand all Loading... |
91 // ApiActivityMonitor | 91 // ApiActivityMonitor |
92 virtual void OnApiEventDispatched( | 92 virtual void OnApiEventDispatched( |
93 const std::string& extension_id, | 93 const std::string& extension_id, |
94 const std::string& event_name, | 94 const std::string& event_name, |
95 scoped_ptr<base::ListValue> event_args) OVERRIDE; | 95 scoped_ptr<base::ListValue> event_args) OVERRIDE; |
96 virtual void OnApiFunctionCalled( | 96 virtual void OnApiFunctionCalled( |
97 const std::string& extension_id, | 97 const std::string& extension_id, |
98 const std::string& api_name, | 98 const std::string& api_name, |
99 scoped_ptr<base::ListValue> event_args) OVERRIDE; | 99 scoped_ptr<base::ListValue> event_args) OVERRIDE; |
100 | 100 |
101 // BrowserContextKeyedService | 101 // KeyedService |
102 virtual void Shutdown() OVERRIDE; | 102 virtual void Shutdown() OVERRIDE; |
103 | 103 |
104 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 104 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
105 | 105 |
106 // Remove actions from the activity log database which IDs specified in the | 106 // Remove actions from the activity log database which IDs specified in the |
107 // action_ids array. | 107 // action_ids array. |
108 void RemoveActions(const std::vector<int64>& action_ids); | 108 void RemoveActions(const std::vector<int64>& action_ids); |
109 | 109 |
110 // Clean up URLs from the activity log database. | 110 // Clean up URLs from the activity log database. |
111 // If restrict_urls is empty then all URLs in the activity log database are | 111 // If restrict_urls is empty then all URLs in the activity log database are |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, WatchdogSwitch); | 210 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, WatchdogSwitch); |
211 DISALLOW_COPY_AND_ASSIGN(ActivityLog); | 211 DISALLOW_COPY_AND_ASSIGN(ActivityLog); |
212 }; | 212 }; |
213 | 213 |
214 template <> | 214 template <> |
215 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies(); | 215 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies(); |
216 | 216 |
217 } // namespace extensions | 217 } // namespace extensions |
218 | 218 |
219 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 219 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
OLD | NEW |