OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "extensions/renderer/dom_activity_logger.h" | 5 #include "extensions/renderer/dom_activity_logger.h" |
6 | 6 |
7 #include "content/public/renderer/render_thread.h" | 7 #include "content/public/renderer/render_thread.h" |
8 #include "content/public/renderer/v8_value_converter.h" | 8 #include "content/public/renderer/v8_value_converter.h" |
9 #include "extensions/common/dom_action_types.h" | 9 #include "extensions/common/dom_action_types.h" |
10 #include "extensions/common/extension_messages.h" | 10 #include "extensions/common/extension_messages.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 void DOMActivityLogger::logEvent(const WebString& event_name, | 107 void DOMActivityLogger::logEvent(const WebString& event_name, |
108 int argc, | 108 int argc, |
109 const WebString* argv, | 109 const WebString* argv, |
110 const WebURL& url, | 110 const WebURL& url, |
111 const WebString& title) { | 111 const WebString& title) { |
112 scoped_ptr<base::ListValue> args(new base::ListValue); | 112 scoped_ptr<base::ListValue> args(new base::ListValue); |
113 std::string event_name_utf8 = event_name.utf8(); | 113 std::string event_name_utf8 = event_name.utf8(); |
114 for (int i = 0; i < argc; ++i) | 114 for (int i = 0; i < argc; ++i) |
115 args->Append(base::Value::CreateStringValue(argv[i])); | 115 args->Append(new base::StringValue(argv[i])); |
116 SendDomActionMessage( | 116 SendDomActionMessage( |
117 event_name_utf8, url, title, DomActionType::METHOD, args.Pass()); | 117 event_name_utf8, url, title, DomActionType::METHOD, args.Pass()); |
118 } | 118 } |
119 | 119 |
120 void DOMActivityLogger::SendDomActionMessage(const std::string& api_call, | 120 void DOMActivityLogger::SendDomActionMessage(const std::string& api_call, |
121 const GURL& url, | 121 const GURL& url, |
122 const base::string16& url_title, | 122 const base::string16& url_title, |
123 DomActionType::Type call_type, | 123 DomActionType::Type call_type, |
124 scoped_ptr<base::ListValue> args) { | 124 scoped_ptr<base::ListValue> args) { |
125 ExtensionHostMsg_DOMAction_Params params; | 125 ExtensionHostMsg_DOMAction_Params params; |
126 params.api_call = api_call; | 126 params.api_call = api_call; |
127 params.url = url; | 127 params.url = url; |
128 params.url_title = url_title; | 128 params.url_title = url_title; |
129 params.call_type = call_type; | 129 params.call_type = call_type; |
130 params.arguments.Swap(args.get()); | 130 params.arguments.Swap(args.get()); |
131 content::RenderThread::Get()->Send( | 131 content::RenderThread::Get()->Send( |
132 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); | 132 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); |
133 } | 133 } |
134 | 134 |
135 } // namespace extensions | 135 } // namespace extensions |
OLD | NEW |