OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_extension.h" | 5 #include "chrome/renderer/searchbox_extension.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 static const char kCancelEventName[] = "chrome.searchBox.oncancel"; | 66 static const char kCancelEventName[] = "chrome.searchBox.oncancel"; |
67 | 67 |
68 static const char kResizeEventName[] = "chrome.searchBox.onresize"; | 68 static const char kResizeEventName[] = "chrome.searchBox.onresize"; |
69 | 69 |
70 // Deprecated API support. | 70 // Deprecated API support. |
71 // TODO(tonyg): Remove these when they are no longer used. | 71 // TODO(tonyg): Remove these when they are no longer used. |
72 // ---------------------------------------------------------------------------- | 72 // ---------------------------------------------------------------------------- |
73 // Script sent as the user is typing and the provider supports instant. | 73 // Script sent as the user is typing and the provider supports instant. |
74 // Params: | 74 // Params: |
75 // . the text the user typed. | 75 // . the text the user typed. |
76 // TODO: add support for the 3rd param. '46' forces the server to give us | 76 // '46' forces the server to give us verbatim results. |
77 // verbatim results. | |
78 static const char kUserInputScript[] = | 77 static const char kUserInputScript[] = |
79 "if (window.chrome.userInput)" | 78 "if (window.chrome.userInput)" |
80 " window.chrome.userInput(" | 79 " window.chrome.userInput(" |
81 " window.chrome.searchBox.value," | 80 " window.chrome.searchBox.value," |
82 " window.chrome.searchBox.verbatim ? 46 : 0," | 81 " window.chrome.searchBox.verbatim ? 46 : 0," |
83 " 0);"; | 82 " window.chrome.searchBox.selectionStart);"; |
84 | 83 |
85 // Script sent when the page is committed and the provider supports instant. | 84 // Script sent when the page is committed and the provider supports instant. |
86 // Params: | 85 // Params: |
87 // . the text the user typed. | 86 // . the text the user typed. |
88 // . boolean indicating if the user pressed enter to accept the text. | 87 // . boolean indicating if the user pressed enter to accept the text. |
89 static const char kUserDoneScript[] = | 88 static const char kUserDoneScript[] = |
90 "if (window.chrome.userWantsQuery)" | 89 "if (window.chrome.userWantsQuery)" |
91 " window.chrome.userWantsQuery(" | 90 " window.chrome.userWantsQuery(" |
92 " window.chrome.searchBox.value," | 91 " window.chrome.searchBox.value," |
93 " window.chrome.searchBox.verbatim);"; | 92 " window.chrome.searchBox.verbatim);"; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 411 |
413 return supports_searchbox_api || supports_deprecated_api; | 412 return supports_searchbox_api || supports_deprecated_api; |
414 } | 413 } |
415 | 414 |
416 // static | 415 // static |
417 v8::Extension* SearchBoxExtension::Get() { | 416 v8::Extension* SearchBoxExtension::Get() { |
418 return new SearchBoxExtensionWrapper(); | 417 return new SearchBoxExtensionWrapper(); |
419 } | 418 } |
420 | 419 |
421 } // namespace extensions_v8 | 420 } // namespace extensions_v8 |
OLD | NEW |