| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_resource_manager.h" | 5 #include "chrome/browser/ui/app_list/search/search_resource_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/ui/app_list/start_page_service.h" | 8 #include "chrome/browser/ui/app_list/start_page_service.h" |
| 9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
| 11 #include "ui/app_list/app_list_features.h" |
| 11 #include "ui/app_list/search_box_model.h" | 12 #include "ui/app_list/search_box_model.h" |
| 12 #include "ui/app_list/speech_ui_model.h" | 13 #include "ui/app_list/speech_ui_model.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 15 | 16 |
| 16 namespace app_list { | 17 namespace app_list { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 std::unique_ptr<SearchBoxModel::SpeechButtonProperty> CreateNewProperty( | 21 std::unique_ptr<SearchBoxModel::SpeechButtonProperty> CreateNewProperty( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 | 34 |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 SearchResourceManager::SearchResourceManager(Profile* profile, | 37 SearchResourceManager::SearchResourceManager(Profile* profile, |
| 37 SearchBoxModel* search_box, | 38 SearchBoxModel* search_box, |
| 38 SpeechUIModel* speech_ui) | 39 SpeechUIModel* speech_ui) |
| 39 : search_box_(search_box), | 40 : search_box_(search_box), |
| 40 speech_ui_(speech_ui) { | 41 speech_ui_(speech_ui) { |
| 41 speech_ui_->AddObserver(this); | 42 speech_ui_->AddObserver(this); |
| 42 | 43 |
| 43 search_box_->SetAccessibleName( | 44 fullscreen_app_list_enabled_ = features::IsFullscreenAppListEnabled(); |
| 44 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); | 45 search_box_->SetAccessibleName(l10n_util::GetStringUTF16( |
| 46 fullscreen_app_list_enabled_ ? IDS_SEARCH_BOX_HINT_FULLSCREEN |
| 47 : IDS_SEARCH_BOX_HINT)); |
| 45 OnSpeechRecognitionStateChanged(speech_ui_->state()); | 48 OnSpeechRecognitionStateChanged(speech_ui_->state()); |
| 46 } | 49 } |
| 47 | 50 |
| 48 SearchResourceManager::~SearchResourceManager() { | 51 SearchResourceManager::~SearchResourceManager() { |
| 49 speech_ui_->RemoveObserver(this); | 52 speech_ui_->RemoveObserver(this); |
| 50 } | 53 } |
| 51 | 54 |
| 52 void SearchResourceManager::OnSpeechRecognitionStateChanged( | 55 void SearchResourceManager::OnSpeechRecognitionStateChanged( |
| 53 SpeechRecognitionState new_state) { | 56 SpeechRecognitionState new_state) { |
| 54 search_box_->SetHintText(l10n_util::GetStringUTF16( | 57 if (fullscreen_app_list_enabled_) { |
| 55 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ? | 58 search_box_->SetHintText( |
| 56 IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT)); | 59 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT_FULLSCREEN)); |
| 60 } else { |
| 61 search_box_->SetHintText(l10n_util::GetStringUTF16( |
| 62 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) |
| 63 ? IDS_SEARCH_BOX_HOTWORD_HINT |
| 64 : IDS_SEARCH_BOX_HINT)); |
| 65 } |
| 57 search_box_->SetSpeechRecognitionButton(CreateNewProperty(new_state)); | 66 search_box_->SetSpeechRecognitionButton(CreateNewProperty(new_state)); |
| 58 } | 67 } |
| 59 | 68 |
| 60 } // namespace app_list | 69 } // namespace app_list |
| OLD | NEW |