| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/common/search_provider.h" | 10 #include "chrome/common/search_provider.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 const char* const kExternalExtensionName = "v8/External"; | 36 const char* const kExternalExtensionName = "v8/External"; |
| 37 | 37 |
| 38 class ExternalExtensionWrapper : public v8::Extension { | 38 class ExternalExtensionWrapper : public v8::Extension { |
| 39 public: | 39 public: |
| 40 ExternalExtensionWrapper(); | 40 ExternalExtensionWrapper(); |
| 41 | 41 |
| 42 // Allows v8's javascript code to call the native functions defined | 42 // Allows v8's javascript code to call the native functions defined |
| 43 // in this class for window.external. | 43 // in this class for window.external. |
| 44 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( | 44 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
| 45 v8::Handle<v8::String> name); | 45 v8::Handle<v8::String> name) OVERRIDE; |
| 46 | 46 |
| 47 // Helper function to find the RenderView. May return NULL. | 47 // Helper function to find the RenderView. May return NULL. |
| 48 static RenderView* GetRenderView(); | 48 static RenderView* GetRenderView(); |
| 49 | 49 |
| 50 // Implementation of window.external.AddSearchProvider. | 50 // Implementation of window.external.AddSearchProvider. |
| 51 static v8::Handle<v8::Value> AddSearchProvider(const v8::Arguments& args); | 51 static v8::Handle<v8::Value> AddSearchProvider(const v8::Arguments& args); |
| 52 | 52 |
| 53 // Implementation of window.external.IsSearchProviderInstalled. | 53 // Implementation of window.external.IsSearchProviderInstalled. |
| 54 static v8::Handle<v8::Value> IsSearchProviderInstalled( | 54 static v8::Handle<v8::Value> IsSearchProviderInstalled( |
| 55 const v8::Arguments& args); | 55 const v8::Arguments& args); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return v8::ThrowException(v8::Exception::Error(v8::String::Empty())); | 138 return v8::ThrowException(v8::Exception::Error(v8::String::Empty())); |
| 139 } | 139 } |
| 140 return v8::Integer::New(install); | 140 return v8::Integer::New(install); |
| 141 } | 141 } |
| 142 | 142 |
| 143 v8::Extension* ExternalExtension::Get() { | 143 v8::Extension* ExternalExtension::Get() { |
| 144 return new ExternalExtensionWrapper(); | 144 return new ExternalExtensionWrapper(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace extensions_v8 | 147 } // namespace extensions_v8 |
| OLD | NEW |