Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: chrome/browser/ui/app_list/search_builder.cc

Issue 10909130: autocomplete: Add AutocompleteProvider::Type enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add !! for windows Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/search_builder.h ('k') | chrome/browser/ui/omnibox/omnibox_edit_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search_builder.cc
diff --git a/chrome/browser/ui/app_list/search_builder.cc b/chrome/browser/ui/app_list/search_builder.cc
index 399cc64c97d31410b601d82e51e918538de4cd15..69156ec4f013bae4ab6a03692839c62a8524c617 100644
--- a/chrome/browser/ui/app_list/search_builder.cc
+++ b/chrome/browser/ui/app_list/search_builder.cc
@@ -7,11 +7,12 @@
#include <string>
#include "base/command_line.h"
+#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_controller.h"
#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
+#include "chrome/browser/autocomplete/autocomplete_provider.h"
#include "chrome/browser/autocomplete/autocomplete_result.h"
-#include "chrome/browser/autocomplete/extension_app_provider.h"
#include "chrome/browser/event_disposition.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
@@ -188,47 +189,29 @@ SearchBuilder::SearchBuilder(
search_box_->SetIcon(*ui::ResourceBundle::GetSharedInstance().
GetImageSkiaNamed(IDR_OMNIBOX_SEARCH));
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- app_list::switches::kAppListShowAppsOnly)) {
- // ExtensionAppProvider is a synchronous provider and does not really need a
- // listener.
- apps_provider_ = new ExtensionAppProvider(NULL, profile);
- } else {
- controller_.reset(new AutocompleteController(profile, this));
- }
+ // 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;
+ controller_.reset(new AutocompleteController(profile, this, providers));
}
SearchBuilder::~SearchBuilder() {
}
void SearchBuilder::StartSearch() {
- const string16& user_text = search_box_->text();
-
- if (controller_.get()) {
- // Omnibox features such as keyword selection/accepting and instant query
- // are not implemented.
- // TODO(xiyuan): Figure out the features that need to support here.
- controller_->Start(user_text, string16(), false, false, true,
- AutocompleteInput::ALL_MATCHES);
- } else {
- AutocompleteInput input(user_text, string16(), false, false, true,
- AutocompleteInput::ALL_MATCHES);
- apps_provider_->Start(input, false);
-
- // ExtensionAppProvider is a synchronous provider and results are ready
- // after returning from Start.
- AutocompleteResult ac_result;
- ac_result.AppendMatches(apps_provider_->matches());
- ac_result.SortAndCull(input);
- PopulateFromACResult(ac_result);
- }
+ // Omnibox features such as keyword selection/accepting and instant query
+ // are not implemented.
+ // TODO(xiyuan): Figure out the features that need to support here.
+ controller_->Start(search_box_->text(), string16(), false, false, true,
+ AutocompleteInput::ALL_MATCHES);
}
void SearchBuilder::StopSearch() {
- if (controller_.get())
- controller_->Stop(true);
- else
- apps_provider_->Stop(true);
+ controller_->Stop(true);
}
void SearchBuilder::OpenResult(const app_list::SearchResult& result,
« no previous file with comments | « chrome/browser/ui/app_list/search_builder.h ('k') | chrome/browser/ui/omnibox/omnibox_edit_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698