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

Side by Side Diff: chrome/browser/ui/app_list/search/search_resource_manager.cc

Issue 2934883002: cros: add new search box hint text for launcher (Closed)
Patch Set: ash::GetChromeOSDeviceName Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/system/devicetype_utils.h"
7 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/ui/app_list/start_page_service.h" 9 #include "chrome/browser/ui/app_list/start_page_service.h"
9 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
10 #include "chrome/grit/theme_resources.h" 11 #include "chrome/grit/theme_resources.h"
12 #include "ui/app_list/app_list_features.h"
11 #include "ui/app_list/search_box_model.h" 13 #include "ui/app_list/search_box_model.h"
12 #include "ui/app_list/speech_ui_model.h" 14 #include "ui/app_list/speech_ui_model.h"
13 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
15 17
16 namespace app_list { 18 namespace app_list {
17 19
18 namespace { 20 namespace {
19 21
20 std::unique_ptr<SearchBoxModel::SpeechButtonProperty> CreateNewProperty( 22 std::unique_ptr<SearchBoxModel::SpeechButtonProperty> CreateNewProperty(
(...skipping 12 matching lines...) Expand all
33 35
34 } // namespace 36 } // namespace
35 37
36 SearchResourceManager::SearchResourceManager(Profile* profile, 38 SearchResourceManager::SearchResourceManager(Profile* profile,
37 SearchBoxModel* search_box, 39 SearchBoxModel* search_box,
38 SpeechUIModel* speech_ui) 40 SpeechUIModel* speech_ui)
39 : search_box_(search_box), 41 : search_box_(search_box),
40 speech_ui_(speech_ui) { 42 speech_ui_(speech_ui) {
41 speech_ui_->AddObserver(this); 43 speech_ui_->AddObserver(this);
42 44
43 search_box_->SetAccessibleName( 45 if (features::IsFullscreenAppListEnabled()) {
44 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT)); 46 search_box_->SetAccessibleName(l10n_util::GetStringFUTF16(
47 IDS_SEARCH_BOX_HINT_FULLSCREEN, ash::GetChromeOSDeviceName()));
48 } else {
49 search_box_->SetAccessibleName(
50 l10n_util::GetStringUTF16(IDS_SEARCH_BOX_HINT));
51 }
45 OnSpeechRecognitionStateChanged(speech_ui_->state()); 52 OnSpeechRecognitionStateChanged(speech_ui_->state());
46 } 53 }
47 54
48 SearchResourceManager::~SearchResourceManager() { 55 SearchResourceManager::~SearchResourceManager() {
49 speech_ui_->RemoveObserver(this); 56 speech_ui_->RemoveObserver(this);
50 } 57 }
51 58
52 void SearchResourceManager::OnSpeechRecognitionStateChanged( 59 void SearchResourceManager::OnSpeechRecognitionStateChanged(
53 SpeechRecognitionState new_state) { 60 SpeechRecognitionState new_state) {
54 search_box_->SetHintText(l10n_util::GetStringUTF16( 61 if (features::IsFullscreenAppListEnabled()) {
55 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ? 62 search_box_->SetHintText(l10n_util::GetStringFUTF16(
56 IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT)); 63 IDS_SEARCH_BOX_HINT_FULLSCREEN, ash::GetChromeOSDeviceName()));
64 } else {
65 search_box_->SetHintText(l10n_util::GetStringUTF16(
66 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING)
67 ? IDS_SEARCH_BOX_HOTWORD_HINT
68 : IDS_SEARCH_BOX_HINT));
69 }
57 search_box_->SetSpeechRecognitionButton(CreateNewProperty(new_state)); 70 search_box_->SetSpeechRecognitionButton(CreateNewProperty(new_state));
58 } 71 }
59 72
60 } // namespace app_list 73 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698