summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/dom_activity_logger.h
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 09:05:27 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 09:05:27 +0000
commitfb5c4744b01f875e32fdeabe85d4448bb7723555 (patch)
tree5029b67a114e031f171101176bc97ea32f988e9e /extensions/renderer/dom_activity_logger.h
parenta1a0897ba14f900ef98016722df0f7e0c8e6d93e (diff)
downloadchromium_src-fb5c4744b01f875e32fdeabe85d4448bb7723555.zip
chromium_src-fb5c4744b01f875e32fdeabe85d4448bb7723555.tar.gz
chromium_src-fb5c4744b01f875e32fdeabe85d4448bb7723555.tar.bz2
Move DOMActivityLogger and associated code from //chrome to //extensions
This is a follow-up to rockot's CL to move extensions::Dispatcher and a precondition to moving c/r/e/extension_helper.cc. This was entirely a mechanical move -- no functional changes. BUG=359836 TEST=compiles Review URL: https://codereview.chromium.org/268553002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/renderer/dom_activity_logger.h')
-rw-r--r--extensions/renderer/dom_activity_logger.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/extensions/renderer/dom_activity_logger.h b/extensions/renderer/dom_activity_logger.h
new file mode 100644
index 0000000..e4b1c2b
--- /dev/null
+++ b/extensions/renderer/dom_activity_logger.h
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_RENDERER_DOM_ACTIVITY_LOGGER_H_
+#define EXTENSIONS_RENDERER_DOM_ACTIVITY_LOGGER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "third_party/WebKit/public/web/WebDOMActivityLogger.h"
+
+namespace content {
+class V8ValueConverter;
+}
+
+namespace extensions {
+
+class ActivityLogConverterStrategy;
+
+// Used to log DOM API calls from within WebKit. The events are sent via IPC to
+// extensions::ActivityLog for recording and display.
+class DOMActivityLogger: public blink::WebDOMActivityLogger {
+ public:
+ static const int kMainWorldId = 0;
+ explicit DOMActivityLogger(const std::string& extension_id);
+ virtual ~DOMActivityLogger();
+
+ // Marshalls the arguments into an ExtensionHostMsg_DOMAction_Params
+ // and sends it over to the browser (via IPC) for appending it to the
+ // extension activity log.
+ // (Overrides the log method in blink::WebDOMActivityLogger)
+ virtual void log(const blink::WebString& api_name,
+ int argc,
+ const v8::Handle<v8::Value> argv[],
+ const blink::WebString& call_type,
+ const blink::WebURL& url,
+ const blink::WebString& title) OVERRIDE;
+
+ // Check (using the WebKit API) if there is no logger attached to the world
+ // corresponding to world_id, and if so, construct a new logger and attach it.
+ // world_id = 0 indicates the main world.
+ static void AttachToWorld(int world_id,
+ const std::string& extension_id);
+
+ private:
+ std::string extension_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(DOMActivityLogger);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_RENDERER_DOM_ACTIVITY_LOGGER_H_
+