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