| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/app_list/search_builder.h" | 5 #include "chrome/browser/ui/app_list/search_builder.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 app_list::AppListModel::SearchResults* results, | 306 app_list::AppListModel::SearchResults* results, |
| 307 AppListControllerDelegate* list_controller) | 307 AppListControllerDelegate* list_controller) |
| 308 : profile_(profile), | 308 : profile_(profile), |
| 309 search_box_(search_box), | 309 search_box_(search_box), |
| 310 results_(results), | 310 results_(results), |
| 311 list_controller_(list_controller) { | 311 list_controller_(list_controller) { |
| 312 search_box_->SetHintText( | 312 search_box_->SetHintText( |
| 313 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); | 313 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); |
| 314 search_box_->SetIcon(*ui::ResourceBundle::GetSharedInstance(). | 314 search_box_->SetIcon(*ui::ResourceBundle::GetSharedInstance(). |
| 315 GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); | 315 GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); |
| 316 search_box_->SetUserIconEnabled(list_controller->ShouldShowUserIcon()); | |
| 317 search_box_->SetUserIcon(*ui::ResourceBundle::GetSharedInstance(). | |
| 318 GetImageSkiaNamed(IDR_APP_LIST_USER_INDICATOR)); | |
| 319 search_box_->SetUserIconTooltip(UTF8ToUTF16(profile_->GetProfileName())); | |
| 320 | 316 |
| 321 int providers = AutocompleteProvider::TYPE_EXTENSION_APP; | 317 int providers = AutocompleteProvider::TYPE_EXTENSION_APP; |
| 322 bool apps_only = true; | 318 bool apps_only = true; |
| 323 #if defined(OS_CHROMEOS) | 319 #if defined(OS_CHROMEOS) |
| 324 apps_only = CommandLine::ForCurrentProcess()->HasSwitch( | 320 apps_only = CommandLine::ForCurrentProcess()->HasSwitch( |
| 325 app_list::switches::kAppListShowAppsOnly); | 321 app_list::switches::kAppListShowAppsOnly); |
| 326 #endif | 322 #endif |
| 327 if (!apps_only) { | 323 if (!apps_only) { |
| 328 // TODO(xiyuan): Consider requesting fewer providers in the non-apps-only | 324 // TODO(xiyuan): Consider requesting fewer providers in the non-apps-only |
| 329 // case. | 325 // case. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 result->Init(profile_, *it); | 449 result->Init(profile_, *it); |
| 454 results_->Add(result); | 450 results_->Add(result); |
| 455 } | 451 } |
| 456 } | 452 } |
| 457 | 453 |
| 458 void SearchBuilder::OnResultChanged(bool default_match_changed) { | 454 void SearchBuilder::OnResultChanged(bool default_match_changed) { |
| 459 // TODO(xiyuan): Handle default match properly. | 455 // TODO(xiyuan): Handle default match properly. |
| 460 const AutocompleteResult& ac_result = controller_->result(); | 456 const AutocompleteResult& ac_result = controller_->result(); |
| 461 PopulateFromACResult(ac_result); | 457 PopulateFromACResult(ac_result); |
| 462 } | 458 } |
| OLD | NEW |