Commit ae113f83 authored by mpearson@chromium.org's avatar mpearson@chromium.org

about:omnibox - add current page classification to possible settings

It's a bit ugly--I wish I could get the text and the dropdown indented a bit (the width of one checkbox) so it lines up with the other text. But it's not a big deal and not worth my time figuring out.

BUG=265675

Review URL: https://codereview.chromium.org/149683005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247854 0039d316-1c4b-4281-b951-d872f2087c98
parent ee2116c7
......@@ -29,6 +29,20 @@
In keyword mode
</label>
</p>
<p>
Current page context:
<select id="page-classification">
<option value="0">Invalid spec</option>
<option value="1">(OBSOLETE) new tab page</option>
<option value="2">about:blank</option>
<option value="3">user's home page</option>
<option value="4">arbitrary URL</option>
<option value="6">search result page doing search term replacement</option>
<option value="9">search result page not doing search term replacement</option>
<option value="7" selected>new tab page with focus in omnibox</option>
<option value="8">new tab page with focus in fakebox</option>
</select>
</p>
<p>Display parameters:</p>
<p>
<label>
......
......@@ -28,6 +28,7 @@ cr.define('omniboxDebug', function() {
$('prevent-inline-autocomplete').addEventListener(
'change', startOmniboxQuery);
$('prefer-keyword').addEventListener('change', startOmniboxQuery);
$('page-classification').addEventListener('change', startOmniboxQuery);
$('show-details').addEventListener('change', refresh);
$('show-incomplete-results').addEventListener('change', refresh);
$('show-all-providers').addEventListener('change', refresh);
......@@ -57,17 +58,19 @@ cr.define('omniboxDebug', function() {
function startOmniboxQuery(event) {
// First, clear the results of past calls (if any).
progressiveAutocompleteResults = [];
// Then, call chrome with a four-element list:
// Then, call chrome with a five-element list:
// - first element: the value in the text box
// - second element: the location of the cursor in the text box
// - third element: the value of prevent-inline-autocomplete
// - forth element: the value of prefer-keyword
// - fifth element: the value of page-classification
cursorPositionUsed = $('input-text').selectionEnd;
chrome.send('startOmniboxQuery', [
$('input-text').value,
cursorPositionUsed,
$('prevent-inline-autocomplete').checked,
$('prefer-keyword').checked]);
$('prefer-keyword').checked,
parseInt($('page-classification').value)]);
// Cancel the submit action. i.e., don't submit the form. (We handle
// display the results solely with Javascript.)
event.preventDefault();
......
......@@ -173,7 +173,7 @@ bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host,
}
void OmniboxUIHandler::StartOmniboxQuery(const base::ListValue* input) {
DCHECK_EQ(4u, input->GetSize());
DCHECK_EQ(5u, input->GetSize());
base::string16 input_string;
bool return_val = input->GetString(0, &input_string);
DCHECK(return_val);
......@@ -186,6 +186,9 @@ void OmniboxUIHandler::StartOmniboxQuery(const base::ListValue* input) {
bool prefer_keyword;
return_val = input->GetBoolean(3, &prefer_keyword);
DCHECK(return_val);
int current_page_classification;
return_val = input->GetInteger(4, &current_page_classification);
DCHECK(return_val);
// Reset the controller. If we don't do this, then the
// AutocompleteController might inappropriately set its |minimal_changes|
// variable (or something else) and some providers will short-circuit
......@@ -198,7 +201,8 @@ void OmniboxUIHandler::StartOmniboxQuery(const base::ListValue* input) {
cursor_position,
base::string16(), // user's desired tld (top-level domain)
GURL(),
AutocompleteInput::INVALID_SPEC,
static_cast<AutocompleteInput::PageClassification>(
current_page_classification),
prevent_inline_autocomplete,
prefer_keyword,
true, // allow exact keyword matches
......
......@@ -55,6 +55,8 @@ class OmniboxUIHandler : public AutocompleteControllerDelegate,
// - third element: boolean indicating whether we should set
// prevent_inline_autocomplete or not.
// - fourth element: boolean indicating whether we should set prefer_keyword
// - fifth element: current page classification value (enum
// PageClassification from omnibox_event.proto)
void StartOmniboxQuery(const base::ListValue* input);
// Helper function for OnResultChanged().
......
......@@ -108,6 +108,10 @@ message OmniboxEventProto {
// replacement, meaning the URL of the page should've appeared in the
// omnibox before the user started editing it, not the search terms.
SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT = 9;
// When adding new classifications, please consider adding them in
// chrome/browser/resources/omnibox/omnibox.html
// so that these new options are displayed on about:omnibox.
}
optional PageClassification current_page_classification = 10;
......
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