| 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 "chrome/renderer/searchbox/searchbox_extension.h" | 5 #include "chrome/renderer/searchbox/searchbox_extension.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 // ---------------------------------------------------------------------------- | 191 // ---------------------------------------------------------------------------- |
| 192 | 192 |
| 193 class SearchBoxExtensionWrapper : public v8::Extension { | 193 class SearchBoxExtensionWrapper : public v8::Extension { |
| 194 public: | 194 public: |
| 195 explicit SearchBoxExtensionWrapper(const base::StringPiece& code); | 195 explicit SearchBoxExtensionWrapper(const base::StringPiece& code); |
| 196 | 196 |
| 197 // Allows v8's javascript code to call the native functions defined | 197 // Allows v8's javascript code to call the native functions defined |
| 198 // in this class for window.chrome. | 198 // in this class for window.chrome. |
| 199 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( | 199 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
| 200 v8::Handle<v8::String> name); | 200 v8::Handle<v8::String> name) OVERRIDE; |
| 201 | 201 |
| 202 // Helper function to find the RenderView. May return NULL. | 202 // Helper function to find the RenderView. May return NULL. |
| 203 static content::RenderView* GetRenderView(); | 203 static content::RenderView* GetRenderView(); |
| 204 | 204 |
| 205 // Gets the value of the user's search query. | 205 // Gets the value of the user's search query. |
| 206 static v8::Handle<v8::Value> GetQuery(const v8::Arguments& args); | 206 static v8::Handle<v8::Value> GetQuery(const v8::Arguments& args); |
| 207 | 207 |
| 208 // Gets whether the |value| should be considered final -- as opposed to a | 208 // Gets whether the |value| should be considered final -- as opposed to a |
| 209 // partial match. This may be set if the user clicks a suggestion, presses | 209 // partial match. This may be set if the user clicks a suggestion, presses |
| 210 // forward delete, or in other cases where Chrome overrides. | 210 // forward delete, or in other cases where Chrome overrides. |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript); | 958 Dispatch(frame, kDispatchThemeAreaHeightChangeEventScript); |
| 959 } | 959 } |
| 960 | 960 |
| 961 // static | 961 // static |
| 962 v8::Extension* SearchBoxExtension::Get() { | 962 v8::Extension* SearchBoxExtension::Get() { |
| 963 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). | 963 return new SearchBoxExtensionWrapper(ResourceBundle::GetSharedInstance(). |
| 964 GetRawDataResource(IDR_SEARCHBOX_API)); | 964 GetRawDataResource(IDR_SEARCHBOX_API)); |
| 965 } | 965 } |
| 966 | 966 |
| 967 } // namespace extensions_v8 | 967 } // namespace extensions_v8 |
| OLD | NEW |