diff options
author | hfung@chromium.org <hfung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 20:59:37 +0000 |
---|---|---|
committer | hfung@chromium.org <hfung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 20:59:37 +0000 |
commit | 12b5cd05088691cde41f5cb75cbd404e39391f19 (patch) | |
tree | fdafe9b44201364250cae2c490be8f12b73936c4 /chrome/browser/autocomplete | |
parent | 9bdf91b23b36aa4bf81a5d5e6fddd3d85e5d7c5b (diff) | |
download | chromium_src-12b5cd05088691cde41f5cb75cbd404e39391f19.zip chromium_src-12b5cd05088691cde41f5cb75cbd404e39391f19.tar.gz chromium_src-12b5cd05088691cde41f5cb75cbd404e39391f19.tar.bz2 |
Shorten INSTANT_NEW_TAB_PAGE_WITH_FAKEBOX_AS_STARTING_FOCUS, INSTANT_NEW_TAB_PAGE_WITH_OMNIBOX_AS_STARTING_FOCUS, NEW_TAB_PAGE, and OBSOLETE_INSTANT_NEW_TAB_PAGE enums.
This is based the suggestion at https://codereview.chromium.org/23621037/diff/972001/chrome/browser/autocomplete/search_provider.cc#newcode941
BUG=
Review URL: https://codereview.chromium.org/65373002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
4 files changed, 13 insertions, 17 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index 10fc04e..9941d92 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -138,7 +138,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { location_entry->model()->SetInputInProgress(true); autocomplete_controller->Start(AutocompleteInput( ASCIIToUTF16("chrome"), string16::npos, string16(), GURL(), - AutocompleteInput::NEW_TAB_PAGE, true, false, true, + AutocompleteInput::NTP, true, false, true, AutocompleteInput::SYNCHRONOUS_MATCHES)); EXPECT_TRUE(autocomplete_controller->done()); diff --git a/chrome/browser/autocomplete/autocomplete_input.h b/chrome/browser/autocomplete/autocomplete_input.h index b65ef67..1e1a64d 100644 --- a/chrome/browser/autocomplete/autocomplete_input.h +++ b/chrome/browser/autocomplete/autocomplete_input.h @@ -56,11 +56,11 @@ class AutocompleteInput { // chrome://newtab/. This can be either the built-in version or a // replacement new tab page from an extension. Note that when Instant // Extended is enabled, the new tab page will be reported as either - // INSTANT_NEW_TAB_PAGE_WITH_OMNIBOX_AS_STARTING_FOCUS or - // INSTANT_NEW_TAB_PAGE_WITH_FAKEBOX_AS_STARTING_FOCUS below, + // INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS or + // INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS below, // unless an extension is replacing the new tab page, in which case - // it will still be reported as NEW_TAB_PAGE. - NEW_TAB_PAGE = 1, + // it will still be reported as NTP. + NTP = 1, // about:blank. BLANK = 2, @@ -81,11 +81,11 @@ class AutocompleteInput { // The new tab page in which this omnibox interaction first started // with the user having focus in the omnibox. - INSTANT_NEW_TAB_PAGE_WITH_OMNIBOX_AS_STARTING_FOCUS = 7, + INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS = 7, // The new tab page in which this omnibox interaction first started // with the user having focus in the fakebox. - INSTANT_NEW_TAB_PAGE_WITH_FAKEBOX_AS_STARTING_FOCUS = 8, + INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS = 8, // The user is on a search result page that's not doing search term // replacement, meaning the URL of the page should've appeared in the diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index fe2ff1f..ff07113 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -936,14 +936,10 @@ bool SearchProvider::CanSendURL( // TODO(hfung): Show Most Visited on NTP with appropriate verbatim // description when the user actively focuses on the omnibox as discussed in // crbug/305366 if Most Visited (or something similar) will launch. - // TODO(hfung): Shorten the INSTANT_NEW_TAB_PAGE_WITH_... enums and remove - // the const variables. - const AutocompleteInput::PageClassification instant_ntp_fakebox = - AutocompleteInput::INSTANT_NEW_TAB_PAGE_WITH_FAKEBOX_AS_STARTING_FOCUS; - const AutocompleteInput::PageClassification instant_ntp_omnibox = - AutocompleteInput::INSTANT_NEW_TAB_PAGE_WITH_OMNIBOX_AS_STARTING_FOCUS; - if ((page_classification == instant_ntp_fakebox) || - (page_classification == instant_ntp_omnibox)) + if ((page_classification == + AutocompleteInput::INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS) || + (page_classification == + AutocompleteInput::INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS)) return false; // Only allow HTTP URLs or HTTPS URLs for the same domain as the search diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index 7094f82..90f3872 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc @@ -3124,14 +3124,14 @@ TEST_F(SearchProviderTest, CanSendURL) { EXPECT_FALSE(SearchProvider::CanSendURL( GURL("http://www.google.com/search"), GURL("https://www.google.com/complete/search"), &google_template_url, - AutocompleteInput::INSTANT_NEW_TAB_PAGE_WITH_FAKEBOX_AS_STARTING_FOCUS, + AutocompleteInput::INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS, &profile_)); // Invalid page classification. EXPECT_FALSE(SearchProvider::CanSendURL( GURL("http://www.google.com/search"), GURL("https://www.google.com/complete/search"), &google_template_url, - AutocompleteInput::INSTANT_NEW_TAB_PAGE_WITH_OMNIBOX_AS_STARTING_FOCUS, + AutocompleteInput::INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS, &profile_)); // HTTPS page URL on same domain as provider. |