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 "chrome/renderer/external_extension.h" | 5 #include "chrome/renderer/external_extension.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "chrome/common/search_provider.h" | 8 #include "chrome/common/search_provider.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "third_party/WebKit/public/web/WebDocument.h" | 10 #include "third_party/WebKit/public/web/WebDocument.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 class ExternalExtensionWrapper : public v8::Extension { | 40 class ExternalExtensionWrapper : public v8::Extension { |
41 public: | 41 public: |
42 ExternalExtensionWrapper(); | 42 ExternalExtensionWrapper(); |
43 | 43 |
44 // Allows v8's javascript code to call the native functions defined | 44 // Allows v8's javascript code to call the native functions defined |
45 // in this class for window.external. | 45 // in this class for window.external. |
46 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( | 46 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( |
47 v8::Isolate* isolate, | 47 v8::Isolate* isolate, |
48 v8::Handle<v8::String> name) OVERRIDE; | 48 v8::Handle<v8::String> name) override; |
49 | 49 |
50 // Helper function to find the RenderView. May return NULL. | 50 // Helper function to find the RenderView. May return NULL. |
51 static RenderView* GetRenderView(); | 51 static RenderView* GetRenderView(); |
52 | 52 |
53 // Implementation of window.external.AddSearchProvider. | 53 // Implementation of window.external.AddSearchProvider. |
54 static void AddSearchProvider( | 54 static void AddSearchProvider( |
55 const v8::FunctionCallbackInfo<v8::Value>& args); | 55 const v8::FunctionCallbackInfo<v8::Value>& args); |
56 | 56 |
57 // Implementation of window.external.IsSearchProviderInstalled. | 57 // Implementation of window.external.IsSearchProviderInstalled. |
58 static void IsSearchProviderInstalled( | 58 static void IsSearchProviderInstalled( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 return; | 158 return; |
159 } | 159 } |
160 args.GetReturnValue().Set(static_cast<int32_t>(install)); | 160 args.GetReturnValue().Set(static_cast<int32_t>(install)); |
161 } | 161 } |
162 | 162 |
163 v8::Extension* ExternalExtension::Get() { | 163 v8::Extension* ExternalExtension::Get() { |
164 return new ExternalExtensionWrapper(); | 164 return new ExternalExtensionWrapper(); |
165 } | 165 } |
166 | 166 |
167 } // namespace extensions_v8 | 167 } // namespace extensions_v8 |
OLD | NEW |