Chromium Code Reviews| Index: chrome/renderer/resources/extensions/searchbox_api.js |
| diff --git a/chrome/renderer/resources/extensions/searchbox_api.js b/chrome/renderer/resources/extensions/searchbox_api.js |
| index bb498d94fe39e47e3fa125e7d7428b7549b8979a..2e5b457b916164bc679052eaa5b7cb454e1ea405 100644 |
| --- a/chrome/renderer/resources/extensions/searchbox_api.js |
| +++ b/chrome/renderer/resources/extensions/searchbox_api.js |
| @@ -94,7 +94,6 @@ if (!chrome.embeddedSearch) { |
| native function GetAutocompleteResults(); |
| native function GetDisplayInstantResults(); |
| native function GetFontSize(); |
| - native function GetSuggestionIframeURLPrefix(); |
| native function IsKeyCaptureEnabled(); |
| native function SetQuery(); |
| native function SetQueryFromAutocompleteResult(); |
| @@ -105,11 +104,10 @@ if (!chrome.embeddedSearch) { |
| native function FocusOmnibox(); |
| native function StartCapturingKeyStrokes(); |
| native function StopCapturingKeyStrokes(); |
| - native function SetSuggestionStyle(); |
| native function NavigateSearchBox(); |
| native function ShowBars(); |
| native function HideBars(); |
| - native function ShouldUseIframes(); |
| + native function GetSuggestionData(); |
| function SafeWrapSuggestion(restrictedText) { |
| return SafeWrap(restrictedText, 22); |
| @@ -127,27 +125,24 @@ if (!chrome.embeddedSearch) { |
| GetAutocompleteResults()); |
| var userInput = GetQuery(); |
| for (var i = 0, result; result = autocompleteResults[i]; ++i) { |
| - if (ShouldUseIframes()) { |
| - result.destination_url = GetSuggestionIframeURLPrefix() + |
| - result.rid; |
| - } else { |
| - // TODO(shishir): Fix the naming violations (chrome_search -> |
| - // chrome-search etc) when the server supports both names. |
| - var className = result.is_search ? 'chrome_search' : 'chrome_url'; |
| - var combinedElement = '<span class=' + className + '>' + |
| - escapeHTML(result.contents) + '</span>'; |
| - if (result.description) { |
| - combinedElement += |
| - '<span class=chrome_separator> – </span>' + |
| - '<span class=chrome_title>' + |
| - escapeHTML(result.description) + '</span>'; |
| - } |
| - result.combinedNode = SafeWrapSuggestion(combinedElement); |
| - result.destination_url = null; |
| + // TODO(shishir): Fix the naming violations (chrome_search -> |
|
samarth
2013/04/05 22:30:25
Add a TODO here to delete the shadow DOM stuff.
Jered
2013/04/06 02:45:16
Shishir has that TODO above.
|
| + // chrome-search etc) when the server supports both names. |
| + var className = result.is_search ? 'chrome_search' : 'chrome_url'; |
| + var combinedElement = '<span class=' + className + '>' + |
| + escapeHTML(result.contents) + '</span>'; |
| + if (result.description) { |
| + combinedElement += |
| + '<span class=chrome_separator> – </span>' + |
| + '<span class=chrome_title>' + |
| + escapeHTML(result.description) + '</span>'; |
| } |
| + result.combinedNode = SafeWrapSuggestion(combinedElement); |
| + result.destination_url = null; |
| result.contents = null; |
| result.description = null; |
| - result.is_search = null; |
| + // result.is_search is not hidden since it is needed to control |
| + // content surrounding a suggestion, e.g. selecting between a |
| + // magnifying glass and a page icon. |
| } |
| return autocompleteResults; |
| } |
| @@ -241,6 +236,11 @@ if (!chrome.embeddedSearch) { |
| this.__defineGetter__('font', GetFont); |
| this.__defineGetter__('fontSize', GetFontSize); |
| + // This method is restricted to chrome-search://suggestion pages by |
| + // checking the invoking context's origin in searchbox_extension.cc. |
| + this.getSuggestionData = function(restrictedId) { |
| + return GetSuggestionData(restrictedId); |
| + }; |
| this.setSuggestions = function(text) { |
| SetSuggestions(text); |
| }; |
| @@ -272,9 +272,6 @@ if (!chrome.embeddedSearch) { |
| this.stopCapturingKeyStrokes = function() { |
| StopCapturingKeyStrokes(); |
| }; |
| - this.setSuggestionStyle = function(url_color, title_color) { |
| - SetSuggestionStyle(url_color, title_color); |
| - }; |
| this.navigateContentWindow = function(destination, disposition) { |
| NavigateSearchBox(destination, disposition); |
| } |