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

Side by Side Diff: content/renderer/web_ui_extension.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "content/renderer/web_ui_extension.h" 5 #include "content/renderer/web_ui_extension.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 std::unique_ptr<base::ListValue> content; 114 std::unique_ptr<base::ListValue> content;
115 if (args->PeekNext().IsEmpty() || args->PeekNext()->IsUndefined()) { 115 if (args->PeekNext().IsEmpty() || args->PeekNext()->IsUndefined()) {
116 content.reset(new base::ListValue()); 116 content.reset(new base::ListValue());
117 } else { 117 } else {
118 v8::Local<v8::Object> obj; 118 v8::Local<v8::Object> obj;
119 if (!args->GetNext(&obj)) { 119 if (!args->GetNext(&obj)) {
120 args->ThrowError(); 120 args->ThrowError();
121 return; 121 return;
122 } 122 }
123 123
124 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); 124 content = base::ListValue::From(V8ValueConverter::Create()->FromV8Value(
125 content = base::ListValue::From( 125 obj, frame->MainWorldScriptContext()));
126 converter->FromV8Value(obj, frame->MainWorldScriptContext()));
127 DCHECK(content); 126 DCHECK(content);
128 } 127 }
129 128
130 // Send the message up to the browser. 129 // Send the message up to the browser.
131 render_view->Send(new ViewHostMsg_WebUISend(render_view->GetRoutingID(), 130 render_view->Send(new ViewHostMsg_WebUISend(render_view->GetRoutingID(),
132 frame->GetDocument().Url(), 131 frame->GetDocument().Url(),
133 message, *content)); 132 message, *content));
134 } 133 }
135 134
136 // static 135 // static
137 std::string WebUIExtension::GetVariableValue(const std::string& name) { 136 std::string WebUIExtension::GetVariableValue(const std::string& name) {
138 blink::WebLocalFrame* frame; 137 blink::WebLocalFrame* frame;
139 RenderView* render_view; 138 RenderView* render_view;
140 if (!ShouldRespondToRequest(&frame, &render_view)) 139 if (!ShouldRespondToRequest(&frame, &render_view))
141 return std::string(); 140 return std::string();
142 141
143 return WebUIExtensionData::Get(render_view)->GetValue(name); 142 return WebUIExtensionData::Get(render_view)->GetValue(name);
144 } 143 }
145 144
146 } // namespace content 145 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/skia_benchmarking_extension.cc ('k') | extensions/renderer/activity_log_converter_strategy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698