Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: extensions/renderer/dom_activity_logger.cc

Issue 1115563002: extensions/renderer: Use v8::Local instead of v8::Handle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/dom_activity_logger.h ('k') | extensions/renderer/event_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/child/v8_value_converter.h" 7 #include "content/public/child/v8_value_converter.h"
8 #include "content/public/renderer/render_thread.h" 8 #include "content/public/renderer/render_thread.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"
11 #include "extensions/renderer/activity_log_converter_strategy.h" 11 #include "extensions/renderer/activity_log_converter_strategy.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
13 #include "third_party/WebKit/public/platform/WebURL.h" 13 #include "third_party/WebKit/public/platform/WebURL.h"
14 14
15 using content::V8ValueConverter; 15 using content::V8ValueConverter;
16 using blink::WebString; 16 using blink::WebString;
17 using blink::WebURL; 17 using blink::WebURL;
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 namespace { 21 namespace {
22 22
23 // 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
24 // conversion succeeds. 24 // conversion succeeds.
25 void AppendV8Value(const std::string& api_name, 25 void AppendV8Value(const std::string& api_name,
26 const v8::Handle<v8::Value>& v8_value, 26 const v8::Local<v8::Value>& v8_value,
27 base::ListValue* list) { 27 base::ListValue* list) {
28 DCHECK(list); 28 DCHECK(list);
29 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 29 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
30 ActivityLogConverterStrategy strategy; 30 ActivityLogConverterStrategy strategy;
31 converter->SetFunctionAllowed(true); 31 converter->SetFunctionAllowed(true);
32 converter->SetStrategy(&strategy); 32 converter->SetStrategy(&strategy);
33 scoped_ptr<base::Value> value(converter->FromV8Value( 33 scoped_ptr<base::Value> value(converter->FromV8Value(
34 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); 34 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext()));
35 35
36 if (value.get()) 36 if (value.get())
(...skipping 25 matching lines...) Expand all
62 const WebURL& url, 62 const WebURL& url,
63 const WebString& title) { 63 const WebString& title) {
64 SendDomActionMessage(api_name.utf8(), 64 SendDomActionMessage(api_name.utf8(),
65 url, 65 url,
66 title, 66 title,
67 DomActionType::GETTER, 67 DomActionType::GETTER,
68 scoped_ptr<base::ListValue>(new base::ListValue())); 68 scoped_ptr<base::ListValue>(new base::ListValue()));
69 } 69 }
70 70
71 void DOMActivityLogger::logSetter(const WebString& api_name, 71 void DOMActivityLogger::logSetter(const WebString& api_name,
72 const v8::Handle<v8::Value>& new_value, 72 const v8::Local<v8::Value>& new_value,
73 const WebURL& url, 73 const WebURL& url,
74 const WebString& title) { 74 const WebString& title) {
75 logSetter(api_name, new_value, v8::Handle<v8::Value>(), url, title); 75 logSetter(api_name, new_value, v8::Local<v8::Value>(), url, title);
76 } 76 }
77 77
78 void DOMActivityLogger::logSetter(const WebString& api_name, 78 void DOMActivityLogger::logSetter(const WebString& api_name,
79 const v8::Handle<v8::Value>& new_value, 79 const v8::Local<v8::Value>& new_value,
80 const v8::Handle<v8::Value>& old_value, 80 const v8::Local<v8::Value>& old_value,
81 const WebURL& url, 81 const WebURL& url,
82 const WebString& title) { 82 const WebString& title) {
83 scoped_ptr<base::ListValue> args(new base::ListValue); 83 scoped_ptr<base::ListValue> args(new base::ListValue);
84 std::string api_name_utf8 = api_name.utf8(); 84 std::string api_name_utf8 = api_name.utf8();
85 AppendV8Value(api_name_utf8, new_value, args.get()); 85 AppendV8Value(api_name_utf8, new_value, args.get());
86 if (!old_value.IsEmpty()) 86 if (!old_value.IsEmpty())
87 AppendV8Value(api_name_utf8, old_value, args.get()); 87 AppendV8Value(api_name_utf8, old_value, args.get());
88 SendDomActionMessage( 88 SendDomActionMessage(
89 api_name_utf8, url, title, DomActionType::SETTER, args.Pass()); 89 api_name_utf8, url, title, DomActionType::SETTER, args.Pass());
90 } 90 }
91 91
92 void DOMActivityLogger::logMethod(const WebString& api_name, 92 void DOMActivityLogger::logMethod(const WebString& api_name,
93 int argc, 93 int argc,
94 const v8::Handle<v8::Value>* argv, 94 const v8::Local<v8::Value>* argv,
95 const WebURL& url, 95 const WebURL& url,
96 const WebString& title) { 96 const WebString& title) {
97 scoped_ptr<base::ListValue> args(new base::ListValue); 97 scoped_ptr<base::ListValue> args(new base::ListValue);
98 std::string api_name_utf8 = api_name.utf8(); 98 std::string api_name_utf8 = api_name.utf8();
99 for (int i = 0; i < argc; ++i) 99 for (int i = 0; i < argc; ++i)
100 AppendV8Value(api_name_utf8, argv[i], args.get()); 100 AppendV8Value(api_name_utf8, argv[i], args.get());
101 SendDomActionMessage( 101 SendDomActionMessage(
102 api_name_utf8, url, title, DomActionType::METHOD, args.Pass()); 102 api_name_utf8, url, title, DomActionType::METHOD, args.Pass());
103 } 103 }
104 104
(...skipping 19 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « extensions/renderer/dom_activity_logger.h ('k') | extensions/renderer/event_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698