OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 9 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
10 #include "chrome/renderer/extensions/dispatcher.h" | 10 #include "chrome/renderer/extensions/dispatcher.h" |
11 #include "v8/include/v8.h" | 11 #include "v8/include/v8.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 // Used to log extension API calls that are implemented with custom bindings. | 15 // Used to log extension API calls that are implemented with custom bindings. |
16 // The events are sent via IPC to extensions::ActivityLog for recording and | 16 // The events are sent via IPC to extensions::ActivityLog for recording and |
17 // display. | 17 // display. |
18 class APIActivityLogger : public ChromeV8Extension { | 18 class APIActivityLogger : public ChromeV8Extension { |
19 public: | 19 public: |
20 APIActivityLogger(Dispatcher* dispatcher, v8::Handle<v8::Context> v8_context); | 20 APIActivityLogger(Dispatcher* dispatcher, v8::Handle<v8::Context> v8_context); |
21 | 21 |
22 // This is ultimately invoked in schema_generated_bindings.js with | 22 // This is ultimately invoked in schema_generated_bindings.js with |
23 // JavaScript arguments... | 23 // JavaScript arguments. Logged as an EventAction or APIAction depending on |
24 // arg0 - extension ID as a string | 24 // the first argument. |
25 // arg1 - API call name as a string | 25 // arg0 - "EVENT" or "API" |
26 // arg2 - arguments to the API call | 26 // arg1 - extension ID as a string |
27 // arg3 - any extra logging info as a string (optional) | 27 // arg2 - API call name as a string |
| 28 // arg3 - arguments to the API call |
| 29 // arg4 - any extra logging info as a string (optional) |
28 static v8::Handle<v8::Value> LogActivity(const v8::Arguments & args); | 30 static v8::Handle<v8::Value> LogActivity(const v8::Arguments & args); |
29 | 31 |
30 private: | 32 private: |
31 DISALLOW_COPY_AND_ASSIGN(APIActivityLogger); | 33 DISALLOW_COPY_AND_ASSIGN(APIActivityLogger); |
32 }; | 34 }; |
33 | 35 |
34 } // namespace extensions | 36 } // namespace extensions |
35 | 37 |
36 #endif // CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ | 38 #endif // CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ |
37 | 39 |
OLD | NEW |