Commit 8ec1cc3a authored by mpearson@chromium.org's avatar mpearson@chromium.org

about:omnibox - add prevent_inline_autocomplete parameter

BUG=


Review URL: https://chromiumcodereview.appspot.com/11818035

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175989 0039d316-1c4b-4281-b951-d872f2087c98
parent 77faf5b9
......@@ -16,6 +16,14 @@
<input id="input-text" type="text" size="40" autofocus>
<input type="submit">
</p>
<p>Input parameters:</p>
<p>
<label>
<input id="prevent-inline-autocomplete" type="checkbox">
Prevent inline autocomplete
</label>
</p>
<p>Display parameters:</p>
<p>
<label>
<input id="show-incomplete-results" type="checkbox">
......
......@@ -25,6 +25,8 @@ cr.define('omniboxDebug', function() {
function initialize() {
$('omnibox-input-form').addEventListener(
'submit', startOmniboxQuery, false);
$('prevent-inline-autocomplete').addEventListener(
'change', startOmniboxQuery);
$('show-details').addEventListener('change', refresh);
$('show-incomplete-results').addEventListener('change', refresh);
$('show-all-providers').addEventListener('change', refresh);
......@@ -46,8 +48,12 @@ cr.define('omniboxDebug', function() {
function startOmniboxQuery(event) {
// First, clear the results of past calls (if any).
progressiveAutocompleteResults = [];
// Then, call chrome with a one-element list: the value in the text box.
chrome.send('startOmniboxQuery', [$('input-text').value]);
// Then, call chrome with a two-element list:
// - first element: the value in the text box
// - second element: the value of prevent-inline-autocomplete
chrome.send('startOmniboxQuery', [
$('input-text').value,
$('prevent-inline-autocomplete').checked]);
// Cancel the submit action. i.e., don't submit the form. (We handle
// display the results solely with Javascript.)
event.preventDefault();
......
......@@ -142,8 +142,15 @@ void OmniboxUIHandler::AddResultToDictionary(const std::string& prefix,
}
void OmniboxUIHandler::StartOmniboxQuery(
const base::ListValue* one_element_input_string) {
string16 input_string = ExtractStringValue(one_element_input_string);
const base::ListValue* two_element_input_string) {
DCHECK_EQ(2u, two_element_input_string->GetSize());
string16 input_string;
bool return_val = two_element_input_string->GetString(0, &input_string);
DCHECK(return_val);
bool prevent_inline_autocomplete;
return_val =
two_element_input_string->GetBoolean(1, &prevent_inline_autocomplete);
DCHECK(return_val);
string16 empty_string;
// Tell the autocomplete controller to start working on the
// input. It's okay if the previous request hasn't yet finished;
......@@ -155,7 +162,7 @@ void OmniboxUIHandler::StartOmniboxQuery(
input_string,
string16::npos,
empty_string, // user's desired tld (top-level domain)
false, // don't prevent inline autocompletion
prevent_inline_autocomplete,
false, // no preferred keyword provider
true, // allow exact keyword matches
AutocompleteInput::ALL_MATCHES)); // want all matches
......
......@@ -49,9 +49,11 @@ class OmniboxUIHandler : public AutocompleteControllerDelegate,
private:
// Gets called from the javascript when a user enters text into the
// chrome://omnibox/ text box and clicks submit or hits enter.
// |one_element_input_string| is expected to be a one-element list
// where the first element is the input string.
void StartOmniboxQuery(const base::ListValue* one_element_input_string);
// |two_element_input_string| is expected to be a two-element list
// where the first element is the input string and the second element
// is a boolean indicating whether we should set prevent_inline_autocomplete
// or not.
void StartOmniboxQuery(const base::ListValue* two_element_input_string);
// Helper function for OnResultChanged().
// Takes an iterator over AutocompleteMatches and packages them into
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment