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

Side by Side Diff: content/renderer/web_ui_bindings.cc

Issue 7647026: base: Add three helper functions to Values API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a typo Ceate -> Create Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/v8_value_converter_browsertest.cc ('k') | ipc/ipc_message_unittest.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_bindings.h" 5 #include "content/renderer/web_ui_bindings.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 20 matching lines...) Expand all
31 // We currently assume all objects are arrays. 31 // We currently assume all objects are arrays.
32 std::vector<CppVariant> vector = value.ToVector(); 32 std::vector<CppVariant> vector = value.ToVector();
33 ListValue* list = new ListValue(); 33 ListValue* list = new ListValue();
34 for (size_t i = 0; i < vector.size(); ++i) { 34 for (size_t i = 0; i < vector.size(); ++i) {
35 list->Append(CreateValueFromCppVariant(vector[i])); 35 list->Append(CreateValueFromCppVariant(vector[i]));
36 } 36 }
37 return list; 37 return list;
38 } 38 }
39 39
40 // Covers null and undefined. 40 // Covers null and undefined.
41 return Value::CreateNullValue(); 41 return base::NullValue();
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 DOMBoundBrowserObject::DOMBoundBrowserObject() 46 DOMBoundBrowserObject::DOMBoundBrowserObject()
47 : sender_(NULL), 47 : sender_(NULL),
48 routing_id_(0) { 48 routing_id_(0) {
49 } 49 }
50 50
51 DOMBoundBrowserObject::~DOMBoundBrowserObject() { 51 DOMBoundBrowserObject::~DOMBoundBrowserObject() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 *(static_cast<ListValue*>(content.get())))); 96 *(static_cast<ListValue*>(content.get()))));
97 } 97 }
98 98
99 void DOMBoundBrowserObject::SetProperty(const std::string& name, 99 void DOMBoundBrowserObject::SetProperty(const std::string& name,
100 const std::string& value) { 100 const std::string& value) {
101 CppVariant* cpp_value = new CppVariant; 101 CppVariant* cpp_value = new CppVariant;
102 cpp_value->Set(value); 102 cpp_value->Set(value);
103 BindProperty(name, cpp_value); 103 BindProperty(name, cpp_value);
104 properties_.push_back(cpp_value); 104 properties_.push_back(cpp_value);
105 } 105 }
OLDNEW
« no previous file with comments | « content/renderer/v8_value_converter_browsertest.cc ('k') | ipc/ipc_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698