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 |
10 #include "chrome/renderer/extensions/dispatcher.h" | |
11 #include "extensions/common/features/feature.h" | 10 #include "extensions/common/features/feature.h" |
| 11 #include "extensions/renderer/object_backed_native_handler.h" |
12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 // Used to log extension API calls and events that are implemented with custom | 16 // Used to log extension API calls and events that are implemented with custom |
17 // bindings.The actions are sent via IPC to extensions::ActivityLog for | 17 // bindings.The actions are sent via IPC to extensions::ActivityLog for |
18 // recording and display. | 18 // recording and display. |
19 class APIActivityLogger : public ChromeV8Extension { | 19 class APIActivityLogger : public ObjectBackedNativeHandler { |
20 public: | 20 public: |
21 APIActivityLogger(Dispatcher* dispatcher, ChromeV8Context* context); | 21 explicit APIActivityLogger(ScriptContext* context); |
22 | 22 |
23 private: | 23 private: |
24 // Used to distinguish API calls & events from each other in LogInternal. | 24 // Used to distinguish API calls & events from each other in LogInternal. |
25 enum CallType { | 25 enum CallType { |
26 APICALL, | 26 APICALL, |
27 EVENT | 27 EVENT |
28 }; | 28 }; |
29 | 29 |
30 // This is ultimately invoked in bindings.js with JavaScript arguments. | 30 // This is ultimately invoked in bindings.js with JavaScript arguments. |
31 // arg0 - extension ID as a string | 31 // arg0 - extension ID as a string |
(...skipping 13 matching lines...) Expand all Loading... |
45 // how they are ultimately dispatched to the log. | 45 // how they are ultimately dispatched to the log. |
46 static void LogInternal(const CallType call_type, | 46 static void LogInternal(const CallType call_type, |
47 const v8::FunctionCallbackInfo<v8::Value>& args); | 47 const v8::FunctionCallbackInfo<v8::Value>& args); |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(APIActivityLogger); | 49 DISALLOW_COPY_AND_ASSIGN(APIActivityLogger); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace extensions | 52 } // namespace extensions |
53 | 53 |
54 #endif // CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ | 54 #endif // CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_ |
OLD | NEW |