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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Clean up URLs from the activity log database. | 111 // Clean up URLs from the activity log database. |
112 // If restrict_urls is empty then all URLs in the activity log database are | 112 // If restrict_urls is empty then all URLs in the activity log database are |
113 // removed, otherwise only those in restrict_urls are removed. | 113 // removed, otherwise only those in restrict_urls are removed. |
114 void RemoveURLs(const std::vector<GURL>& restrict_urls); | 114 void RemoveURLs(const std::vector<GURL>& restrict_urls); |
115 void RemoveURLs(const std::set<GURL>& restrict_urls); | 115 void RemoveURLs(const std::set<GURL>& restrict_urls); |
116 void RemoveURL(const GURL& url); | 116 void RemoveURL(const GURL& url); |
117 | 117 |
118 // Deletes the database associated with the policy that's currently in use. | 118 // Deletes the database associated with the policy that's currently in use. |
119 void DeleteDatabase(); | 119 void DeleteDatabase(); |
120 | 120 |
| 121 bool is_active() const { return is_active_; } |
| 122 |
121 // If we're in a browser test, we need to pretend that the watchdog app is | 123 // If we're in a browser test, we need to pretend that the watchdog app is |
122 // active. | 124 // active. |
123 void SetWatchdogAppActiveForTesting(bool active); | 125 void SetWatchdogAppActiveForTesting(bool active); |
124 | 126 |
125 private: | 127 private: |
126 friend class ActivityLogTest; | 128 friend class ActivityLogTest; |
127 friend class BrowserContextKeyedAPIFactory<ActivityLog>; | 129 friend class BrowserContextKeyedAPIFactory<ActivityLog>; |
128 | 130 |
129 explicit ActivityLog(content::BrowserContext* context); | 131 explicit ActivityLog(content::BrowserContext* context); |
130 ~ActivityLog() override; | 132 ~ActivityLog() override; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // added or removed, enabled_ may change. | 198 // added or removed, enabled_ may change. |
197 ScopedObserver<extensions::ExtensionRegistry, | 199 ScopedObserver<extensions::ExtensionRegistry, |
198 extensions::ExtensionRegistryObserver> | 200 extensions::ExtensionRegistryObserver> |
199 extension_registry_observer_; | 201 extension_registry_observer_; |
200 | 202 |
201 // Set if the watchdog app is installed and enabled. Maintained by | 203 // Set if the watchdog app is installed and enabled. Maintained by |
202 // kWatchdogExtensionActive pref variable. Since there are multiple valid | 204 // kWatchdogExtensionActive pref variable. Since there are multiple valid |
203 // extension IDs, this needs to be an int to count how many are installed. | 205 // extension IDs, this needs to be an int to count how many are installed. |
204 int watchdog_apps_active_; | 206 int watchdog_apps_active_; |
205 | 207 |
206 // True if the activity log is currently active. | 208 // True if the activity log is currently active, meaning that the user has |
| 209 // either added the commandline switch or has loaded a compatible extension. |
| 210 // While inactive, the activity log will not store any actions for performance |
| 211 // reasons. |
207 bool is_active_; | 212 bool is_active_; |
208 | 213 |
209 content::NotificationRegistrar registrar_; | 214 content::NotificationRegistrar registrar_; |
210 | 215 |
211 FRIEND_TEST_ALL_PREFIXES(ActivityLogApiTest, TriggerEvent); | 216 FRIEND_TEST_ALL_PREFIXES(ActivityLogApiTest, TriggerEvent); |
212 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, AppAndCommandLine); | 217 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, AppAndCommandLine); |
213 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, CommandLineSwitch); | 218 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, CommandLineSwitch); |
214 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, NoSwitch); | 219 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, NoSwitch); |
215 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, PrefSwitch); | 220 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, PrefSwitch); |
216 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, WatchdogSwitch); | 221 FRIEND_TEST_ALL_PREFIXES(ActivityLogEnabledTest, WatchdogSwitch); |
217 DISALLOW_COPY_AND_ASSIGN(ActivityLog); | 222 DISALLOW_COPY_AND_ASSIGN(ActivityLog); |
218 }; | 223 }; |
219 | 224 |
220 template <> | 225 template <> |
221 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies(); | 226 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies(); |
222 | 227 |
223 } // namespace extensions | 228 } // namespace extensions |
224 | 229 |
225 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ | 230 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ |
OLD | NEW |