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" | |
10 #include "extensions/common/dom_action_types.h" | 9 #include "extensions/common/dom_action_types.h" |
11 #include "extensions/common/extension_messages.h" | 10 #include "extensions/common/extension_messages.h" |
12 #include "extensions/renderer/activity_log_converter_strategy.h" | 11 #include "extensions/renderer/activity_log_converter_strategy.h" |
13 #include "third_party/WebKit/public/platform/WebString.h" | 12 #include "third_party/WebKit/public/platform/WebString.h" |
14 #include "third_party/WebKit/public/platform/WebURL.h" | 13 #include "third_party/WebKit/public/platform/WebURL.h" |
15 | 14 |
16 using content::V8ValueConverter; | 15 using content::V8ValueConverter; |
17 using blink::WebString; | 16 using blink::WebString; |
18 using blink::WebURL; | 17 using blink::WebURL; |
19 | 18 |
20 namespace extensions { | 19 namespace extensions { |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 // Converts the given |v8_value| and appends it to the given |list|, if the | 23 // Converts the given |v8_value| and appends it to the given |list|, if the |
25 // conversion succeeds. | 24 // conversion succeeds. |
26 void AppendV8Value(const std::string& api_name, | 25 void AppendV8Value(const std::string& api_name, |
27 const v8::Handle<v8::Value>& v8_value, | 26 const v8::Handle<v8::Value>& v8_value, |
28 base::ListValue* list) { | 27 base::ListValue* list) { |
29 DCHECK(list); | 28 DCHECK(list); |
30 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 29 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
31 ActivityLogConverterStrategy strategy; | 30 ActivityLogConverterStrategy strategy; |
32 strategy.set_enable_detailed_parsing( | |
33 ad_injection_constants::ApiCanInjectAds(api_name)); | |
34 converter->SetFunctionAllowed(true); | 31 converter->SetFunctionAllowed(true); |
35 converter->SetStrategy(&strategy); | 32 converter->SetStrategy(&strategy); |
36 scoped_ptr<base::Value> value(converter->FromV8Value( | 33 scoped_ptr<base::Value> value(converter->FromV8Value( |
37 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); | 34 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); |
38 | 35 |
39 if (value.get()) | 36 if (value.get()) |
40 list->Append(value.release()); | 37 list->Append(value.release()); |
41 } | 38 } |
42 | 39 |
43 } // namespace | 40 } // namespace |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 params.api_call = api_call; | 126 params.api_call = api_call; |
130 params.url = url; | 127 params.url = url; |
131 params.url_title = url_title; | 128 params.url_title = url_title; |
132 params.call_type = call_type; | 129 params.call_type = call_type; |
133 params.arguments.Swap(args.get()); | 130 params.arguments.Swap(args.get()); |
134 content::RenderThread::Get()->Send( | 131 content::RenderThread::Get()->Send( |
135 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); | 132 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); |
136 } | 133 } |
137 | 134 |
138 } // namespace extensions | 135 } // namespace extensions |
OLD | NEW |