OLD | NEW |
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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/public/common/bindings_policy.h" | 10 #include "content/public/common/bindings_policy.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // We expect at least two parameters - a string message identifier, and | 114 // We expect at least two parameters - a string message identifier, and |
115 // an object parameter. The object param can be undefined. | 115 // an object parameter. The object param can be undefined. |
116 if (args.Length() != 2 || !args[0]->IsString()) | 116 if (args.Length() != 2 || !args[0]->IsString()) |
117 return; | 117 return; |
118 | 118 |
119 const std::string message = *v8::String::Utf8Value(args[0]->ToString()); | 119 const std::string message = *v8::String::Utf8Value(args[0]->ToString()); |
120 | 120 |
121 // If they've provided an optional message parameter, convert that into a | 121 // If they've provided an optional message parameter, convert that into a |
122 // Value to send to the browser process. | 122 // Value to send to the browser process. |
123 scoped_ptr<ListValue> content; | 123 scoped_ptr<base::ListValue> content; |
124 if (args[1]->IsUndefined()) { | 124 if (args[1]->IsUndefined()) { |
125 content.reset(new ListValue()); | 125 content.reset(new base::ListValue()); |
126 } else { | 126 } else { |
127 if (!args[1]->IsObject()) | 127 if (!args[1]->IsObject()) |
128 return; | 128 return; |
129 | 129 |
130 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 130 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
131 | 131 |
132 base::Value* value = converter->FromV8Value( | 132 base::Value* value = converter->FromV8Value( |
133 args[1], frame->mainWorldScriptContext()); | 133 args[1], frame->mainWorldScriptContext()); |
134 base::ListValue* list = NULL; | 134 base::ListValue* list = NULL; |
135 value->GetAsList(&list); | 135 value->GetAsList(&list); |
(...skipping 26 matching lines...) Expand all Loading... |
162 v8::String::kNormalString, | 162 v8::String::kNormalString, |
163 value.length())); | 163 value.length())); |
164 } | 164 } |
165 | 165 |
166 // static | 166 // static |
167 v8::Extension* WebUIExtension::Get() { | 167 v8::Extension* WebUIExtension::Get() { |
168 return new WebUIExtensionWrapper(); | 168 return new WebUIExtensionWrapper(); |
169 } | 169 } |
170 | 170 |
171 } // namespace content | 171 } // namespace content |
OLD | NEW |