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" |
11 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.h" |
12 #include "content/public/renderer/render_thread.h" | 12 #include "content/public/renderer/render_thread.h" |
13 #include "content/public/renderer/render_view.h" | 13 #include "content/public/renderer/render_view.h" |
14 #include "content/public/renderer/v8_value_converter.h" | 14 #include "content/public/renderer/v8_value_converter.h" |
15 #include "content/renderer/web_ui_extension_data.h" | 15 #include "content/renderer/web_ui_extension_data.h" |
16 #include "googleurl/src/gurl.h" | |
17 #include "third_party/WebKit/public/web/WebDocument.h" | 16 #include "third_party/WebKit/public/web/WebDocument.h" |
18 #include "third_party/WebKit/public/web/WebFrame.h" | 17 #include "third_party/WebKit/public/web/WebFrame.h" |
19 #include "third_party/WebKit/public/web/WebView.h" | 18 #include "third_party/WebKit/public/web/WebView.h" |
| 19 #include "url/gurl.h" |
20 #include "v8/include/v8.h" | 20 #include "v8/include/v8.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 static const char* const kWebUIExtensionName = "v8/WebUI"; | 24 static const char* const kWebUIExtensionName = "v8/WebUI"; |
25 | 25 |
26 // Javascript that gets executed when the extension loads into all frames. | 26 // Javascript that gets executed when the extension loads into all frames. |
27 // Exposes two methods: | 27 // Exposes two methods: |
28 // - chrome.send: Used to send messages to the browser. Requires the message | 28 // - chrome.send: Used to send messages to the browser. Requires the message |
29 // name as the first argument and can have an optional second argument that | 29 // name as the first argument and can have an optional second argument that |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 std::string value = WebUIExtensionData::Get(render_view)->GetValue(key); | 157 std::string value = WebUIExtensionData::Get(render_view)->GetValue(key); |
158 args.GetReturnValue().Set(v8::String::New(value.c_str(), value.length())); | 158 args.GetReturnValue().Set(v8::String::New(value.c_str(), value.length())); |
159 } | 159 } |
160 | 160 |
161 // static | 161 // static |
162 v8::Extension* WebUIExtension::Get() { | 162 v8::Extension* WebUIExtension::Get() { |
163 return new WebUIExtensionWrapper(); | 163 return new WebUIExtensionWrapper(); |
164 } | 164 } |
165 | 165 |
166 } // namespace content | 166 } // namespace content |
OLD | NEW |