| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/public/child/v8_value_converter.h" | 9 #include "content/public/child/v8_value_converter.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 void DOMActivityLogger::logEvent(const WebString& event_name, | 104 void DOMActivityLogger::logEvent(const WebString& event_name, |
| 105 int argc, | 105 int argc, |
| 106 const WebString* argv, | 106 const WebString* argv, |
| 107 const WebURL& url, | 107 const WebURL& url, |
| 108 const WebString& title) { | 108 const WebString& title) { |
| 109 std::unique_ptr<base::ListValue> args(new base::ListValue); | 109 std::unique_ptr<base::ListValue> args(new base::ListValue); |
| 110 std::string event_name_utf8 = event_name.utf8(); | 110 std::string event_name_utf8 = event_name.utf8(); |
| 111 for (int i = 0; i < argc; ++i) | 111 for (int i = 0; i < argc; ++i) |
| 112 args->Append(new base::StringValue(argv[i])); | 112 args->AppendString(argv[i]); |
| 113 SendDomActionMessage(event_name_utf8, url, title, DomActionType::METHOD, | 113 SendDomActionMessage(event_name_utf8, url, title, DomActionType::METHOD, |
| 114 std::move(args)); | 114 std::move(args)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void DOMActivityLogger::SendDomActionMessage( | 117 void DOMActivityLogger::SendDomActionMessage( |
| 118 const std::string& api_call, | 118 const std::string& api_call, |
| 119 const GURL& url, | 119 const GURL& url, |
| 120 const base::string16& url_title, | 120 const base::string16& url_title, |
| 121 DomActionType::Type call_type, | 121 DomActionType::Type call_type, |
| 122 std::unique_ptr<base::ListValue> args) { | 122 std::unique_ptr<base::ListValue> args) { |
| 123 ExtensionHostMsg_DOMAction_Params params; | 123 ExtensionHostMsg_DOMAction_Params params; |
| 124 params.api_call = api_call; | 124 params.api_call = api_call; |
| 125 params.url = url; | 125 params.url = url; |
| 126 params.url_title = url_title; | 126 params.url_title = url_title; |
| 127 params.call_type = call_type; | 127 params.call_type = call_type; |
| 128 params.arguments.Swap(args.get()); | 128 params.arguments.Swap(args.get()); |
| 129 content::RenderThread::Get()->Send( | 129 content::RenderThread::Get()->Send( |
| 130 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); | 130 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace extensions | 133 } // namespace extensions |
| OLD | NEW |