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_DOM_ACTIVITY_LOGGER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_DOM_ACTIVITY_LOGGER_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_DOM_ACTIVITY_LOGGER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_DOM_ACTIVITY_LOGGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "third_party/WebKit/public/platform/WebString.h" | 11 #include "third_party/WebKit/public/platform/WebString.h" |
12 #include "third_party/WebKit/public/platform/WebURL.h" | 12 #include "third_party/WebKit/public/platform/WebURL.h" |
13 #include "third_party/WebKit/public/web/WebDOMActivityLogger.h" | 13 #include "third_party/WebKit/public/web/WebDOMActivityLogger.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
16 | 16 |
17 // Used to log DOM API calls from within WebKit. The events are sent via IPC to | 17 // Used to log DOM API calls from within WebKit. The events are sent via IPC to |
18 // extensions::ActivityLog for recording and display. | 18 // extensions::ActivityLog for recording and display. |
19 namespace extensions { | 19 namespace extensions { |
20 | 20 |
21 class DOMActivityLogger: public WebKit::WebDOMActivityLogger { | 21 class DOMActivityLogger: public blink::WebDOMActivityLogger { |
22 public: | 22 public: |
23 static const int kMainWorldId = 0; | 23 static const int kMainWorldId = 0; |
24 explicit DOMActivityLogger(const std::string& extension_id); | 24 explicit DOMActivityLogger(const std::string& extension_id); |
25 | 25 |
26 // Marshalls the arguments into an ExtensionHostMsg_DOMAction_Params | 26 // Marshalls the arguments into an ExtensionHostMsg_DOMAction_Params |
27 // and sends it over to the browser (via IPC) for appending it to the | 27 // and sends it over to the browser (via IPC) for appending it to the |
28 // extension activity log. | 28 // extension activity log. |
29 // (Overrides the log method in WebKit::WebDOMActivityLogger) | 29 // (Overrides the log method in blink::WebDOMActivityLogger) |
30 virtual void log(const WebKit::WebString& api_name, | 30 virtual void log(const blink::WebString& api_name, |
31 int argc, | 31 int argc, |
32 const v8::Handle<v8::Value> argv[], | 32 const v8::Handle<v8::Value> argv[], |
33 const WebKit::WebString& call_type, | 33 const blink::WebString& call_type, |
34 const WebKit::WebURL& url, | 34 const blink::WebURL& url, |
35 const WebKit::WebString& title); | 35 const blink::WebString& title); |
36 | 36 |
37 // Check (using the WebKit API) if there is no logger attached to the world | 37 // Check (using the WebKit API) if there is no logger attached to the world |
38 // corresponding to world_id, and if so, construct a new logger and attach it. | 38 // corresponding to world_id, and if so, construct a new logger and attach it. |
39 // world_id = 0 indicates the main world. | 39 // world_id = 0 indicates the main world. |
40 static void AttachToWorld(int world_id, | 40 static void AttachToWorld(int world_id, |
41 const std::string& extension_id); | 41 const std::string& extension_id); |
42 | 42 |
43 private: | 43 private: |
44 std::string extension_id_; | 44 std::string extension_id_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(DOMActivityLogger); | 46 DISALLOW_COPY_AND_ASSIGN(DOMActivityLogger); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace extensions | 49 } // namespace extensions |
50 | 50 |
51 #endif // CHROME_RENDERER_EXTENSIONS_DOM_ACTIVITY_LOGGER_H_ | 51 #endif // CHROME_RENDERER_EXTENSIONS_DOM_ACTIVITY_LOGGER_H_ |
52 | 52 |
OLD | NEW |