OLD | NEW |
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/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/WebURL.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Creates a Value which is a copy of the CppVariant |value|. All objects are | 19 // Creates a Value which is a copy of the CppVariant |value|. All objects are |
20 // treated as Lists for now since CppVariant does not distinguish arrays in any | 20 // treated as Lists for now since CppVariant does not distinguish arrays in any |
21 // convenient way and we currently have no need of non array objects. | 21 // convenient way and we currently have no need of non array objects. |
22 Value* CreateValueFromCppVariant(const CppVariant& value) { | 22 Value* CreateValueFromCppVariant(const CppVariant& value) { |
23 if (value.isBool()) | 23 if (value.isBool()) |
24 return Value::CreateBooleanValue(value.ToBoolean()); | 24 return Value::CreateBooleanValue(value.ToBoolean()); |
25 if (value.isDouble()) | 25 if (value.isDouble()) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 *(static_cast<ListValue*>(content.get())))); | 98 *(static_cast<ListValue*>(content.get())))); |
99 } | 99 } |
100 | 100 |
101 void DOMBoundBrowserObject::SetProperty(const std::string& name, | 101 void DOMBoundBrowserObject::SetProperty(const std::string& name, |
102 const std::string& value) { | 102 const std::string& value) { |
103 CppVariant* cpp_value = new CppVariant; | 103 CppVariant* cpp_value = new CppVariant; |
104 cpp_value->Set(value); | 104 cpp_value->Set(value); |
105 BindProperty(name, cpp_value); | 105 BindProperty(name, cpp_value); |
106 properties_.push_back(cpp_value); | 106 properties_.push_back(cpp_value); |
107 } | 107 } |
OLD | NEW |