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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 " native function GetVariableValue();" | 42 " native function GetVariableValue();" |
43 " return GetVariableValue(name);" | 43 " return GetVariableValue(name);" |
44 "};"; | 44 "};"; |
45 | 45 |
46 class WebUIExtensionWrapper : public v8::Extension { | 46 class WebUIExtensionWrapper : public v8::Extension { |
47 public: | 47 public: |
48 WebUIExtensionWrapper(); | 48 WebUIExtensionWrapper(); |
49 virtual ~WebUIExtensionWrapper(); | 49 virtual ~WebUIExtensionWrapper(); |
50 | 50 |
51 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( | 51 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
52 v8::Handle<v8::String> name); | 52 v8::Handle<v8::String> name) OVERRIDE; |
53 static v8::Handle<v8::Value> Send(const v8::Arguments& args); | 53 static v8::Handle<v8::Value> Send(const v8::Arguments& args); |
54 static v8::Handle<v8::Value> GetVariableValue(const v8::Arguments& args); | 54 static v8::Handle<v8::Value> GetVariableValue(const v8::Arguments& args); |
55 | 55 |
56 private: | 56 private: |
57 static bool ShouldRespondToRequest(WebKit::WebFrame** frame_ptr, | 57 static bool ShouldRespondToRequest(WebKit::WebFrame** frame_ptr, |
58 RenderView** render_view_ptr); | 58 RenderView** render_view_ptr); |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(WebUIExtensionWrapper); | 60 DISALLOW_COPY_AND_ASSIGN(WebUIExtensionWrapper); |
61 }; | 61 }; |
62 | 62 |
(...skipping 94 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 return v8::String::New(value.c_str(), value.length()); | 158 return 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 |