summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 12:09:41 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 12:09:41 +0000
commitd1ac65d7ab167521e89065fe7a5140c6c63f37c2 (patch)
tree75303520ed53cba3875499318bf398c5ff4ba80e
parent844f32c1415968b20107b8eca0ab829cc89773ea (diff)
downloadchromium_src-d1ac65d7ab167521e89065fe7a5140c6c63f37c2.zip
chromium_src-d1ac65d7ab167521e89065fe7a5140c6c63f37c2.tar.gz
chromium_src-d1ac65d7ab167521e89065fe7a5140c6c63f37c2.tar.bz2
Remove app from omnibox results.
BUG=157748 TEST=Apps should not show up in omnibox results but should still show up in app list search. R=pkasting@chromium.org,mihaip@chromium.org, Review URL: https://chromiumcodereview.appspot.com/11363064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166388 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_browsertest.cc59
-rw-r--r--chrome/browser/autocomplete/autocomplete_classifier.cc1
-rw-r--r--chrome/browser/ui/app_list/search_builder.cc14
3 files changed, 7 insertions, 67 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc
index ce9675a..9f270c2 100644
--- a/chrome/browser/autocomplete/autocomplete_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc
@@ -259,62 +259,3 @@ IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, FocusSearch) {
EXPECT_EQ(7U, std::max(selection_start, selection_end));
}
}
-
-IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, ExtensionAppProvider) {
- WaitForTemplateURLServiceToLoad();
- ExtensionService* service = browser()->profile()->GetExtensionService();
- size_t extension_count = service->extensions()->size();
-
- FilePath test_dir;
- ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
- // Load a packaged app.
- extensions::UnpackedInstaller::Create(service)->Load(
- test_dir.AppendASCII("extensions").AppendASCII("packaged_app"));
- WaitForExtensionLoad();
- // Load a hosted app.
- extensions::UnpackedInstaller::Create(service)->Load(
- test_dir.AppendASCII("extensions").AppendASCII("app"));
- WaitForExtensionLoad();
- ASSERT_EQ(extension_count + 2U, service->extensions()->size());
-
- // The results depend on the history backend being loaded. Make sure it is
- // loaded so that the autocomplete results are consistent.
- ui_test_utils::WaitForHistoryToLoad(
- HistoryServiceFactory::GetForProfile(browser()->profile(),
- Profile::EXPLICIT_ACCESS));
-
- AutocompleteController* autocomplete_controller = GetAutocompleteController();
-
- // Try out the packaged app.
- {
- autocomplete_controller->Start(
- ASCIIToUTF16("Packaged App Test"), string16(), true, false, true,
- AutocompleteInput::SYNCHRONOUS_MATCHES);
-
- EXPECT_TRUE(autocomplete_controller->done());
- const AutocompleteResult& result = autocomplete_controller->result();
- EXPECT_GT(result.size(), 1U) << AutocompleteResultAsString(result);
- AutocompleteMatch match = result.match_at(0);
- EXPECT_EQ(ASCIIToUTF16("Packaged App Test"), match.contents);
- EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type);
- EXPECT_FALSE(match.deletable);
- }
-
- chrome::NewTab(browser());
-
- // Try out the hosted app.
- {
- autocomplete_controller->Start(
- ASCIIToUTF16("App Test"), string16(), true, false, true,
- AutocompleteInput::SYNCHRONOUS_MATCHES);
-
- EXPECT_TRUE(autocomplete_controller->done());
- const AutocompleteResult& result = autocomplete_controller->result();
- // 'App test' is also a substring of extension 'Packaged App Test'.
- EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result);
- AutocompleteMatch match = result.match_at(0);
- EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents);
- EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type);
- EXPECT_FALSE(match.deletable);
- }
-}
diff --git a/chrome/browser/autocomplete/autocomplete_classifier.cc b/chrome/browser/autocomplete/autocomplete_classifier.cc
index 0732ef4..a857ac3 100644
--- a/chrome/browser/autocomplete/autocomplete_classifier.cc
+++ b/chrome/browser/autocomplete/autocomplete_classifier.cc
@@ -15,7 +15,6 @@
const int AutocompleteClassifier::kDefaultOmniboxProviders =
AutocompleteProvider::TYPE_BOOKMARK |
AutocompleteProvider::TYPE_BUILTIN |
- AutocompleteProvider::TYPE_EXTENSION_APP |
AutocompleteProvider::TYPE_HISTORY_CONTENTS |
AutocompleteProvider::TYPE_HISTORY_QUICK |
AutocompleteProvider::TYPE_HISTORY_URL |
diff --git a/chrome/browser/ui/app_list/search_builder.cc b/chrome/browser/ui/app_list/search_builder.cc
index 24137a8..86d195e 100644
--- a/chrome/browser/ui/app_list/search_builder.cc
+++ b/chrome/browser/ui/app_list/search_builder.cc
@@ -305,13 +305,13 @@ SearchBuilder::SearchBuilder(
search_box_->SetIcon(*ui::ResourceBundle::GetSharedInstance().
GetImageSkiaNamed(IDR_OMNIBOX_SEARCH));
- // TODO(xiyuan): Consider requesting fewer providers in the non-apps-only
- // case.
- int providers =
- CommandLine::ForCurrentProcess()->HasSwitch(
- app_list::switches::kAppListShowAppsOnly) ?
- AutocompleteProvider::TYPE_EXTENSION_APP :
- AutocompleteClassifier::kDefaultOmniboxProviders;
+ int providers = AutocompleteProvider::TYPE_EXTENSION_APP;
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ app_list::switches::kAppListShowAppsOnly)) {
+ // TODO(xiyuan): Consider requesting fewer providers in the non-apps-only
+ // case.
+ providers |= AutocompleteClassifier::kDefaultOmniboxProviders;
+ }
#if defined(OS_CHROMEOS)
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableContacts))
providers |= AutocompleteProvider::TYPE_CONTACT;