OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_params.h" | 9 #include "chrome/common/render_messages_params.h" |
10 #include "chrome/renderer/render_view.h" | 10 #include "chrome/renderer/render_view.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 "};"; | 39 "};"; |
40 | 40 |
41 #undef SEARCH_PROVIDER_API_V1 | 41 #undef SEARCH_PROVIDER_API_V1 |
42 | 42 |
43 const char* const kExternalExtensionName = "v8/External"; | 43 const char* const kExternalExtensionName = "v8/External"; |
44 | 44 |
45 // Should the new api's "IsSearchProviderInstalled and InstallSearchProvider | 45 // Should the new api's "IsSearchProviderInstalled and InstallSearchProvider |
46 // with an extra parameter to indicate if the provider should be the default" | 46 // with an extra parameter to indicate if the provider should be the default" |
47 // be available? | 47 // be available? |
48 static bool EnableSearchProviderV2() { | 48 static bool EnableSearchProviderV2() { |
| 49 #if defined(OS_WIN) |
| 50 return true; |
| 51 #else |
49 return CommandLine::ForCurrentProcess()->HasSwitch( | 52 return CommandLine::ForCurrentProcess()->HasSwitch( |
50 switches::kEnableSearchProviderApiV2); | 53 switches::kEnableSearchProviderApiV2); |
| 54 #endif |
51 } | 55 } |
52 | 56 |
53 class ExternalExtensionWrapper : public v8::Extension { | 57 class ExternalExtensionWrapper : public v8::Extension { |
54 public: | 58 public: |
55 ExternalExtensionWrapper(); | 59 ExternalExtensionWrapper(); |
56 | 60 |
57 // Allows v8's javascript code to call the native functions defined | 61 // Allows v8's javascript code to call the native functions defined |
58 // in this class for window.external. | 62 // in this class for window.external. |
59 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( | 63 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
60 v8::Handle<v8::String> name); | 64 v8::Handle<v8::String> name); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return v8::ThrowException(v8::Exception::Error(v8::String::Empty())); | 150 return v8::ThrowException(v8::Exception::Error(v8::String::Empty())); |
147 } | 151 } |
148 return v8::Integer::New(install.state); | 152 return v8::Integer::New(install.state); |
149 } | 153 } |
150 | 154 |
151 v8::Extension* ExternalExtension::Get() { | 155 v8::Extension* ExternalExtension::Get() { |
152 return new ExternalExtensionWrapper(); | 156 return new ExternalExtensionWrapper(); |
153 } | 157 } |
154 | 158 |
155 } // namespace extensions_v8 | 159 } // namespace extensions_v8 |
OLD | NEW |