Added documentation to web_view.js/web_view_experimental.js regarding the webview...
[chromium-blink-merge.git] / chrome / renderer / extensions / api_activity_logger.h
blobbfb9787f6c0c3615884fa6943d54f8be3b4e2d42
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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_
6 #define CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_
8 #include <string>
9 #include "chrome/renderer/extensions/chrome_v8_extension.h"
10 #include "chrome/renderer/extensions/dispatcher.h"
11 #include "extensions/common/features/feature.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 ChromeV8Extension {
20 public:
21 APIActivityLogger(Dispatcher* dispatcher, ChromeV8Context* context);
23 private:
24 // Used to distinguish API calls & events from each other in LogInternal.
25 enum CallType {
26 APICALL,
27 EVENT
30 // This is ultimately invoked in bindings.js with JavaScript arguments.
31 // arg0 - extension ID as a string
32 // arg1 - API call name as a string
33 // arg2 - arguments to the API call
34 // arg3 - any extra logging info as a string (optional)
35 static void LogAPICall(const v8::FunctionCallbackInfo<v8::Value>& args);
37 // This is ultimately invoked in bindings.js with JavaScript arguments.
38 // arg0 - extension ID as a string
39 // arg1 - Event name as a string
40 // arg2 - Event arguments
41 // arg3 - any extra logging info as a string (optional)
42 static void LogEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
44 // LogAPICall and LogEvent are really the same underneath except for
45 // how they are ultimately dispatched to the log.
46 static void LogInternal(const CallType call_type,
47 const v8::FunctionCallbackInfo<v8::Value>& args);
49 DISALLOW_COPY_AND_ASSIGN(APIActivityLogger);
52 } // namespace extensions
54 #endif // CHROME_RENDERER_EXTENSIONS_API_ACTIVITY_LOGGER_H_