OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_bindings.h" | 5 #include "content/renderer/web_ui_bindings.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "content/common/view_messages.h" | 12 #include "content/common/view_messages.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
16 | 16 |
17 using webkit_glue::CppArgumentList; | 17 using webkit_glue::CppArgumentList; |
18 using webkit_glue::CppVariant; | 18 using webkit_glue::CppVariant; |
19 | 19 |
| 20 namespace content { |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Creates a Value which is a copy of the CppVariant |value|. All objects are | 23 // Creates a Value which is a copy of the CppVariant |value|. All objects are |
23 // treated as Lists for now since CppVariant does not distinguish arrays in any | 24 // treated as Lists for now since CppVariant does not distinguish arrays in any |
24 // convenient way and we currently have no need of non array objects. | 25 // convenient way and we currently have no need of non array objects. |
25 Value* CreateValueFromCppVariant(const CppVariant& value) { | 26 Value* CreateValueFromCppVariant(const CppVariant& value) { |
26 if (value.isBool()) | 27 if (value.isBool()) |
27 return Value::CreateBooleanValue(value.ToBoolean()); | 28 return Value::CreateBooleanValue(value.ToBoolean()); |
28 if (value.isDouble()) | 29 if (value.isDouble()) |
29 return Value::CreateDoubleValue(value.ToDouble()); | 30 return Value::CreateDoubleValue(value.ToDouble()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 *(static_cast<ListValue*>(content.get())))); | 102 *(static_cast<ListValue*>(content.get())))); |
102 } | 103 } |
103 | 104 |
104 void DOMBoundBrowserObject::SetProperty(const std::string& name, | 105 void DOMBoundBrowserObject::SetProperty(const std::string& name, |
105 const std::string& value) { | 106 const std::string& value) { |
106 CppVariant* cpp_value = new CppVariant; | 107 CppVariant* cpp_value = new CppVariant; |
107 cpp_value->Set(value); | 108 cpp_value->Set(value); |
108 BindProperty(name, cpp_value); | 109 BindProperty(name, cpp_value); |
109 properties_.push_back(cpp_value); | 110 properties_.push_back(cpp_value); |
110 } | 111 } |
| 112 |
| 113 } // namespace content |
OLD | NEW |