Change DtmfSenderHandler to handle events on the signaling thread.
[chromium-blink-merge.git] / extensions / renderer / api_activity_logger.h
blob13f23f9d8a93ff11b025f27302ef5774ca5dada2
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_RENDERER_API_ACTIVITY_LOGGER_H_
6 #define EXTENSIONS_RENDERER_API_ACTIVITY_LOGGER_H_
8 #include <string>
10 #include "extensions/common/features/feature.h"
11 #include "extensions/renderer/object_backed_native_handler.h"
12 #include "v8/include/v8.h"
14 namespace extensions {
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
18 // recording and display.
19 class APIActivityLogger : public ObjectBackedNativeHandler {
20 public:
21 explicit APIActivityLogger(ScriptContext* context);
23 private:
24 // Used to distinguish API calls & events from each other in LogInternal.
25 enum CallType { APICALL, EVENT };
27 // This is ultimately invoked in bindings.js with JavaScript arguments.
28 // arg0 - extension ID as a string
29 // arg1 - API call name as a string
30 // arg2 - arguments to the API call
31 // arg3 - any extra logging info as a string (optional)
32 static void LogAPICall(const v8::FunctionCallbackInfo<v8::Value>& args);
34 // This is ultimately invoked in bindings.js with JavaScript arguments.
35 // arg0 - extension ID as a string
36 // arg1 - Event name as a string
37 // arg2 - Event arguments
38 // arg3 - any extra logging info as a string (optional)
39 static void LogEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
41 // LogAPICall and LogEvent are really the same underneath except for
42 // how they are ultimately dispatched to the log.
43 static void LogInternal(const CallType call_type,
44 const v8::FunctionCallbackInfo<v8::Value>& args);
46 DISALLOW_COPY_AND_ASSIGN(APIActivityLogger);
49 } // namespace extensions
51 #endif // EXTENSIONS_RENDERER_API_ACTIVITY_LOGGER_H_