OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/search_controller.h" | 5 #include "chrome/browser/ui/app_list/search/search_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 SearchController::~SearchController() {} | 54 SearchController::~SearchController() {} |
55 | 55 |
56 void SearchController::Init() { | 56 void SearchController::Init() { |
57 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 57 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
58 search_box_->SetHintText( | 58 search_box_->SetHintText( |
59 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); | 59 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); |
60 search_box_->SetIcon(*bundle.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); | 60 search_box_->SetIcon(*bundle.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); |
61 if (StartPageService::Get(profile_)) { | 61 if (StartPageService::Get(profile_)) { |
62 search_box_->SetSpeechRecognitionButton( | 62 search_box_->SetSpeechRecognitionButton( |
63 scoped_ptr<SearchBoxModel::ToggleButtonProperty>( | 63 scoped_ptr<SearchBoxModel::ButtonProperty>( |
64 new SearchBoxModel::ToggleButtonProperty( | 64 new SearchBoxModel::ButtonProperty( |
65 // Right now provides the same image for both state. | |
66 // TODO(mukai, jennschen): Replace them by the real images. | |
67 *bundle.GetImageSkiaNamed(IDR_OMNIBOX_MIC_SEARCH), | |
68 *bundle.GetImageSkiaNamed(IDR_OMNIBOX_MIC_SEARCH), | 65 *bundle.GetImageSkiaNamed(IDR_OMNIBOX_MIC_SEARCH), |
69 l10n_util::GetStringUTF16( | 66 l10n_util::GetStringUTF16( |
70 IDS_APP_LIST_START_SPEECH_RECOGNITION), | 67 IDS_APP_LIST_START_SPEECH_RECOGNITION)))); |
71 l10n_util::GetStringUTF16( | |
72 IDS_APP_LIST_STOP_SPEECH_RECOGNITION)))); | |
73 } | 68 } |
74 | 69 |
75 mixer_->Init(); | 70 mixer_->Init(); |
76 | 71 |
77 AddProvider(Mixer::MAIN_GROUP, scoped_ptr<SearchProvider>( | 72 AddProvider(Mixer::MAIN_GROUP, scoped_ptr<SearchProvider>( |
78 new AppSearchProvider(profile_, list_controller_)).Pass()); | 73 new AppSearchProvider(profile_, list_controller_)).Pass()); |
79 AddProvider(Mixer::OMNIBOX_GROUP, scoped_ptr<SearchProvider>( | 74 AddProvider(Mixer::OMNIBOX_GROUP, scoped_ptr<SearchProvider>( |
80 new OmniboxProvider(profile_)).Pass()); | 75 new OmniboxProvider(profile_)).Pass()); |
81 AddProvider(Mixer::WEBSTORE_GROUP, scoped_ptr<SearchProvider>( | 76 AddProvider(Mixer::WEBSTORE_GROUP, scoped_ptr<SearchProvider>( |
82 new WebstoreProvider(profile_, list_controller_)).Pass()); | 77 new WebstoreProvider(profile_, list_controller_)).Pass()); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 KnownResults known_results; | 157 KnownResults known_results; |
163 if (history_ && history_->IsReady()) { | 158 if (history_ && history_->IsReady()) { |
164 history_->GetKnownResults(UTF16ToUTF8(search_box_->text())) | 159 history_->GetKnownResults(UTF16ToUTF8(search_box_->text())) |
165 ->swap(known_results); | 160 ->swap(known_results); |
166 } | 161 } |
167 | 162 |
168 mixer_->MixAndPublish(known_results); | 163 mixer_->MixAndPublish(known_results); |
169 } | 164 } |
170 | 165 |
171 } // namespace app_list | 166 } // namespace app_list |
OLD | NEW |