| 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" | |
| 16 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 17 #include "base/observer_list_threadsafe.h" | 16 #include "base/observer_list_threadsafe.h" |
| 18 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 19 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 20 #include "chrome/browser/extensions/activity_actions.h" | 19 #include "chrome/browser/extensions/activity_actions.h" |
| 21 #include "chrome/browser/extensions/activity_database.h" | 20 #include "chrome/browser/extensions/activity_database.h" |
| 22 #include "chrome/browser/extensions/tab_helper.h" | 21 #include "chrome/browser/extensions/tab_helper.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_dependency_manager.h" | 23 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 25 #include "chrome/browser/profiles/profile_keyed_service.h" | 24 #include "chrome/browser/profiles/profile_keyed_service.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // A map of extensions to activity observers for that extension. | 192 // A map of extensions to activity observers for that extension. |
| 194 ObserverMap observers_; | 193 ObserverMap observers_; |
| 195 | 194 |
| 196 // The database wrapper that does the actual database I/O. | 195 // The database wrapper that does the actual database I/O. |
| 197 scoped_refptr<extensions::ActivityDatabase> db_; | 196 scoped_refptr<extensions::ActivityDatabase> db_; |
| 198 | 197 |
| 199 // Whether to log activity to stdout or the UI. These are set by switches. | 198 // Whether to log activity to stdout or the UI. These are set by switches. |
| 200 bool log_activity_to_stdout_; | 199 bool log_activity_to_stdout_; |
| 201 bool log_activity_to_ui_; | 200 bool log_activity_to_ui_; |
| 202 | 201 |
| 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 | |
| 210 DISALLOW_COPY_AND_ASSIGN(ActivityLog); | 202 DISALLOW_COPY_AND_ASSIGN(ActivityLog); |
| 211 }; | 203 }; |
| 212 | 204 |
| 213 // Each profile has different extensions, so we keep a different database for | 205 // Each profile has different extensions, so we keep a different database for |
| 214 // each profile. | 206 // each profile. |
| 215 class ActivityLogFactory : public ProfileKeyedServiceFactory { | 207 class ActivityLogFactory : public ProfileKeyedServiceFactory { |
| 216 public: | 208 public: |
| 217 static ActivityLog* GetForProfile(Profile* profile) { | 209 static ActivityLog* GetForProfile(Profile* profile) { |
| 218 return static_cast<ActivityLog*>( | 210 return static_cast<ActivityLog*>( |
| 219 GetInstance()->GetServiceForProfile(profile, true)); | 211 GetInstance()->GetServiceForProfile(profile, true)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 233 | 225 |
| 234 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; | 226 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; |
| 235 | 227 |
| 236 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); | 228 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); |
| 237 }; | 229 }; |
| 238 | 230 |
| 239 | 231 |
| 240 } // namespace extensions | 232 } // namespace extensions |
| 241 | 233 |
| 242 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ | 234 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_H_ |
| OLD | NEW |