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

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

Issue 15520002: Moved DOMActionType information from extras into a real field (ActivityLog) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added prefix Created 7 years, 7 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 | Annotate | Revision Log
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/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/hash_tables.h"
16 #include "base/memory/singleton.h" 16 #include "base/memory/singleton.h"
17 #include "base/observer_list_threadsafe.h" 17 #include "base/observer_list_threadsafe.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "chrome/browser/extensions/activity_log/activity_actions.h" 20 #include "chrome/browser/extensions/activity_log/activity_actions.h"
21 #include "chrome/browser/extensions/activity_log/activity_database.h" 21 #include "chrome/browser/extensions/activity_log/activity_database.h"
22 #include "chrome/browser/extensions/tab_helper.h" 22 #include "chrome/browser/extensions/tab_helper.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/common/extensions/dom_action_types.h"
24 #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"
25 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 26 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
26 #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"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 29
29 class Profile; 30 class Profile;
30 using content::BrowserThread; 31 using content::BrowserThread;
31 32
32 namespace extensions { 33 namespace extensions {
33 class Extension; 34 class Extension;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Log a blocked API call made by an extension. 94 // Log a blocked API call made by an extension.
94 // This will create a BlockedAction for storage in the database. 95 // This will create a BlockedAction for storage in the database.
95 void LogBlockedAction(const Extension* extension, 96 void LogBlockedAction(const Extension* extension,
96 const std::string& blocked_call, // e.g., tabs.get 97 const std::string& blocked_call, // e.g., tabs.get
97 ListValue* args, // argument values 98 ListValue* args, // argument values
98 const BlockedAction::Reason reason, // why it's blocked 99 const BlockedAction::Reason reason, // why it's blocked
99 const std::string& extra); // extra logging info 100 const std::string& extra); // extra logging info
100 101
101 // Log an interaction between an extension and a URL. 102 // Log an interaction between an extension and a URL.
102 // This will create a DOMAction for storage in the database. 103 // This will create a DOMAction for storage in the database.
103 // The technical message might be the list of content scripts that have been
104 // injected, or the DOM API call; it's what's shown under "More".
105 void LogDOMAction(const Extension* extension, 104 void LogDOMAction(const Extension* extension,
106 const GURL& url, // target URL 105 const GURL& url, // target URL
107 const string16& url_title, // title of the URL 106 const string16& url_title, // title of the URL
108 const std::string& api_call, // api call 107 const std::string& api_call, // api call
109 const ListValue* args, // arguments 108 const ListValue* args, // arguments
109 DomActionType::Type call_type, // type of the call
110 const std::string& extra); // extra logging info 110 const std::string& extra); // extra logging info
111 111
112 // Log a use of the WebRequest API to redirect, cancel, or modify page 112 // Log a use of the WebRequest API to redirect, cancel, or modify page
113 // headers. 113 // headers.
114 void LogWebRequestAction(const Extension* extension, 114 void LogWebRequestAction(const Extension* extension,
115 const GURL& url, 115 const GURL& url,
116 const std::string& api_call, 116 const std::string& api_call,
117 scoped_ptr<base::DictionaryValue> details, 117 scoped_ptr<base::DictionaryValue> details,
118 const std::string& extra); 118 const std::string& extra);
119 119
(...skipping 22 matching lines...) Expand all
142 142
143 // We log callbacks and API calls very similarly, so we handle them the same 143 // We log callbacks and API calls very similarly, so we handle them the same
144 // way internally. 144 // way internally.
145 void LogAPIActionInternal( 145 void LogAPIActionInternal(
146 const Extension* extension, 146 const Extension* extension,
147 const std::string& api_call, 147 const std::string& api_call,
148 ListValue* args, 148 ListValue* args,
149 const std::string& extra, 149 const std::string& extra,
150 const APIAction::Type type); 150 const APIAction::Type type);
151 151
152 // We log content script injection and DOM API calls using the same underlying
153 // mechanism, so they have the same internal logging structure.
154 void LogDOMActionInternal(const Extension* extension,
155 const GURL& url,
156 const string16& url_title,
157 const std::string& api_call,
158 const ListValue* args,
159 const std::string& extra,
160 DOMAction::DOMActionType verb);
161
162 // TabHelper::ScriptExecutionObserver implementation. 152 // TabHelper::ScriptExecutionObserver implementation.
163 // Fires when a ContentScript is executed. 153 // Fires when a ContentScript is executed.
164 virtual void OnScriptsExecuted( 154 virtual void OnScriptsExecuted(
165 const content::WebContents* web_contents, 155 const content::WebContents* web_contents,
166 const ExecutingScriptsMap& extension_ids, 156 const ExecutingScriptsMap& extension_ids,
167 int32 page_id, 157 int32 page_id,
168 const GURL& on_url) OVERRIDE; 158 const GURL& on_url) OVERRIDE;
169 159
170 // The callback when initializing the database. 160 // The callback when initializing the database.
171 void OnDBInitComplete(); 161 void OnDBInitComplete();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 virtual content::BrowserContext* GetBrowserContextToUse( 243 virtual content::BrowserContext* GetBrowserContextToUse(
254 content::BrowserContext* context) const OVERRIDE; 244 content::BrowserContext* context) const OVERRIDE;
255 245
256 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory); 246 DISALLOW_COPY_AND_ASSIGN(ActivityLogFactory);
257 }; 247 };
258 248
259 249
260 } // namespace extensions 250 } // namespace extensions
261 251
262 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_ 252 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698