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_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/hash_tables.h" |
15 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
16 #include "base/observer_list_threadsafe.h" | 17 #include "base/observer_list_threadsafe.h" |
17 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
18 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
19 #include "chrome/browser/extensions/activity_actions.h" | 20 #include "chrome/browser/extensions/activity_actions.h" |
20 #include "chrome/browser/extensions/activity_database.h" | 21 #include "chrome/browser/extensions/activity_database.h" |
21 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_dependency_manager.h" | 24 #include "chrome/browser/profiles/profile_dependency_manager.h" |
24 #include "chrome/browser/profiles/profile_keyed_service.h" | 25 #include "chrome/browser/profiles/profile_keyed_service.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // A map of extensions to activity observers for that extension. | 193 // A map of extensions to activity observers for that extension. |
193 ObserverMap observers_; | 194 ObserverMap observers_; |
194 | 195 |
195 // The database wrapper that does the actual database I/O. | 196 // The database wrapper that does the actual database I/O. |
196 scoped_refptr<extensions::ActivityDatabase> db_; | 197 scoped_refptr<extensions::ActivityDatabase> db_; |
197 | 198 |
198 // Whether to log activity to stdout or the UI. These are set by switches. | 199 // Whether to log activity to stdout or the UI. These are set by switches. |
199 bool log_activity_to_stdout_; | 200 bool log_activity_to_stdout_; |
200 bool log_activity_to_ui_; | 201 bool log_activity_to_ui_; |
201 | 202 |
| 203 // log_arguments controls whether to log API call arguments. By default, we |
| 204 // don't log most arguments to avoid saving too much data. In testing mode, |
| 205 // argument collection is enabled. We also whitelist some arguments for |
| 206 // collection regardless of whether this bool is true. |
| 207 bool log_arguments_; |
| 208 base::hash_set<std::string> arg_whitelist_api_; |
| 209 |
202 DISALLOW_COPY_AND_ASSIGN(ActivityLog); | 210 DISALLOW_COPY_AND_ASSIGN(ActivityLog); |
203 }; | 211 }; |
204 | 212 |
205 // Each profile has different extensions, so we keep a different database for | 213 // Each profile has different extensions, so we keep a different database for |
206 // each profile. | 214 // each profile. |
207 class ActivityLogFactory : public ProfileKeyedServiceFactory { | 215 class ActivityLogFactory : public ProfileKeyedServiceFactory { |
208 public: | 216 public: |
209 static ActivityLog* GetForProfile(Profile* profile) { | 217 static ActivityLog* GetForProfile(Profile* profile) { |
210 return static_cast<ActivityLog*>( | 218 return static_cast<ActivityLog*>( |
211 GetInstance()->GetServiceForProfile(profile, true)); | 219 GetInstance()->GetServiceForProfile(profile, true)); |
(...skipping 13 matching lines...) Expand all Loading... |
225 | 233 |
226 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; | 234 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; |
227 | 235 |
228 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); | 236 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); |
229 }; | 237 }; |
230 | 238 |
231 | 239 |
232 } // namespace extensions | 240 } // namespace extensions |
233 | 241 |
234 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ | 242 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ |
OLD | NEW |