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

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

Issue 2931393003: [Content] Update V8ValueConverter::create to return a std::unique_ptr (Closed)
Patch Set: rebase Created 3 years, 6 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
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 <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"
11 #include "extensions/common/dom_action_types.h" 11 #include "extensions/common/dom_action_types.h"
12 #include "extensions/common/extension_messages.h" 12 #include "extensions/common/extension_messages.h"
13 #include "extensions/renderer/activity_log_converter_strategy.h" 13 #include "extensions/renderer/activity_log_converter_strategy.h"
14 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "third_party/WebKit/public/platform/WebURL.h" 15 #include "third_party/WebKit/public/platform/WebURL.h"
16 16
17 using content::V8ValueConverter;
18 using blink::WebString; 17 using blink::WebString;
19 using blink::WebURL; 18 using blink::WebURL;
20 19
21 namespace extensions { 20 namespace extensions {
22 21
23 namespace { 22 namespace {
24 23
25 // Converts the given |v8_value| and appends it to the given |list|, if the 24 // Converts the given |v8_value| and appends it to the given |list|, if the
26 // conversion succeeds. 25 // conversion succeeds.
27 void AppendV8Value(const std::string& api_name, 26 void AppendV8Value(const std::string& api_name,
28 const v8::Local<v8::Value>& v8_value, 27 const v8::Local<v8::Value>& v8_value,
29 base::ListValue* list) { 28 base::ListValue* list) {
30 DCHECK(list); 29 DCHECK(list);
31 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 30 std::unique_ptr<content::V8ValueConverter> converter =
31 content::V8ValueConverter::Create();
32 ActivityLogConverterStrategy strategy; 32 ActivityLogConverterStrategy strategy;
33 converter->SetFunctionAllowed(true); 33 converter->SetFunctionAllowed(true);
34 converter->SetStrategy(&strategy); 34 converter->SetStrategy(&strategy);
35 std::unique_ptr<base::Value> value(converter->FromV8Value( 35 std::unique_ptr<base::Value> value(converter->FromV8Value(
36 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); 36 v8_value, v8::Isolate::GetCurrent()->GetCurrentContext()));
37 37
38 if (value.get()) 38 if (value.get())
39 list->Append(std::move(value)); 39 list->Append(std::move(value));
40 } 40 }
41 41
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/display_source_custom_bindings.cc ('k') | extensions/renderer/event_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698