Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log.h

Issue 19690003: Extension activity log database refactoring (step 3) (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactor2
Patch Set: Do not set bad BlockedChromeActivityDetail::Reason values Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/observer_list_threadsafe.h" 14 #include "base/observer_list_threadsafe.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "chrome/browser/extensions/activity_log/activity_actions.h" 17 #include "chrome/browser/extensions/activity_log/activity_actions.h"
18 #include "chrome/browser/extensions/activity_log/activity_database.h" 18 #include "chrome/browser/extensions/activity_log/activity_database.h"
19 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" 19 #include "chrome/browser/extensions/activity_log/activity_log_policy.h"
20 #include "chrome/browser/extensions/activity_log/api_actions.h"
21 #include "chrome/browser/extensions/install_observer.h" 20 #include "chrome/browser/extensions/install_observer.h"
22 #include "chrome/browser/extensions/install_tracker.h" 21 #include "chrome/browser/extensions/install_tracker.h"
23 #include "chrome/browser/extensions/tab_helper.h" 22 #include "chrome/browser/extensions/tab_helper.h"
24 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/common/extensions/dom_action_types.h" 24 #include "chrome/common/extensions/dom_action_types.h"
26 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 25 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
27 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 26 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
28 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h" 27 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h"
29 28
30 class Profile; 29 class Profile;
(...skipping 28 matching lines...) Expand all
59 // If you want to know whether the log is enabled but DON'T have a profile 58 // If you want to know whether the log is enabled but DON'T have a profile
60 // object yet, use this method. However, it's preferable for the caller to 59 // object yet, use this method. However, it's preferable for the caller to
61 // use IsLogEnabled when possible. 60 // use IsLogEnabled when possible.
62 static bool IsLogEnabledOnAnyProfile(); 61 static bool IsLogEnabledOnAnyProfile();
63 62
64 // Add/remove observer: the activityLogPrivate API only listens when the 63 // Add/remove observer: the activityLogPrivate API only listens when the
65 // ActivityLog extension is registered for an event. 64 // ActivityLog extension is registered for an event.
66 void AddObserver(Observer* observer); 65 void AddObserver(Observer* observer);
67 void RemoveObserver(Observer* observer); 66 void RemoveObserver(Observer* observer);
68 67
68 // Logs an extension action: passes it to any installed policy to be logged
69 // to the database, to any observers, and logs to the console if in testing
70 // mode.
71 //
72 // The convenience Log*Action methods below can be used as well if the caller
73 // does not wish to construct the Action object itself, however those methods
74 // are somewhat deprecated.
75 void LogAction(scoped_refptr<Action> action);
76
77 // TODO(mvrable): The calls below take args as a raw pointer, but the callee
78 // does not own the object so these should more properly be a const pointer.
79 // The callee is forced to make a copy of the object which in some cases is
80 // wasteful, and it could be better to take a scoped_ptr as input. Switching
81 // to using LogAction is another way to clean this up.
82
69 // Log a successful API call made by an extension. 83 // Log a successful API call made by an extension.
70 // This will create an APIAction for storage in the database. 84 // This will create an APIAction for storage in the database.
71 // (Note: implemented as a wrapper for LogAPIActionInternal.) 85 // (Note: implemented as a wrapper for LogAPIActionInternal.)
72 void LogAPIAction(const std::string& extension_id, 86 void LogAPIAction(const std::string& extension_id,
73 const std::string& name, // e.g., tabs.get 87 const std::string& name, // e.g., tabs.get
74 base::ListValue* args, // the argument values e.g. 46 88 base::ListValue* args, // the argument values e.g. 46
75 const std::string& extra); // any extra logging info 89 const std::string& extra); // any extra logging info
76 90
77 // Log an event notification delivered to an extension. 91 // Log an event notification delivered to an extension.
78 // This will create an APIAction for storage in the database. 92 // This will create an APIAction for storage in the database.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 virtual content::BrowserContext* GetBrowserContextToUse( 255 virtual content::BrowserContext* GetBrowserContextToUse(
242 content::BrowserContext* context) const OVERRIDE; 256 content::BrowserContext* context) const OVERRIDE;
243 257
244 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); 258 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory);
245 }; 259 };
246 260
247 261
248 } // namespace extensions 262 } // namespace extensions
249 263
250 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ 264 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698