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

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

Issue 935293002: Launcher Search box, Back and Mic buttons now focusable in ChromeVox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tileitemview-setselected
Patch Set: Avoid using ContentsView (fix tests). Created 5 years, 10 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 | « no previous file | ui/app_list/search_box_model.h » ('j') | 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 "chrome/browser/ui/app_list/start_page_service.h" 7 #include "chrome/browser/ui/app_list/start_page_service.h"
8 #include "grit/components_scaled_resources.h" 8 #include "grit/components_scaled_resources.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
11 #include "ui/app_list/search_box_model.h" 11 #include "ui/app_list/search_box_model.h"
12 #include "ui/app_list/speech_ui_model.h" 12 #include "ui/app_list/speech_ui_model.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 15
16 namespace app_list { 16 namespace app_list {
17 17
18 namespace { 18 namespace {
19 19
20 scoped_ptr<SearchBoxModel::SpeechButtonProperty> CreateNewProperty( 20 scoped_ptr<SearchBoxModel::SpeechButtonProperty> CreateNewProperty(
21 SpeechRecognitionState state) { 21 SpeechRecognitionState state) {
22 if (state == SPEECH_RECOGNITION_OFF) 22 if (state == SPEECH_RECOGNITION_OFF)
23 return nullptr; 23 return nullptr;
24 24
25 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 25 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
26 return make_scoped_ptr(new SearchBoxModel::SpeechButtonProperty( 26 return make_scoped_ptr(new SearchBoxModel::SpeechButtonProperty(
27 *bundle.GetImageSkiaNamed(IDR_APP_LIST_MIC_HOTWORD_ON), 27 *bundle.GetImageSkiaNamed(IDR_APP_LIST_MIC_HOTWORD_ON),
28 l10n_util::GetStringUTF16(IDS_APP_LIST_HOTWORD_LISTENING), 28 l10n_util::GetStringUTF16(IDS_APP_LIST_HOTWORD_LISTENING),
29 *bundle.GetImageSkiaNamed(IDR_APP_LIST_MIC_HOTWORD_OFF), 29 *bundle.GetImageSkiaNamed(IDR_APP_LIST_MIC_HOTWORD_OFF),
30 l10n_util::GetStringUTF16(IDS_APP_LIST_START_SPEECH_RECOGNITION))); 30 l10n_util::GetStringUTF16(IDS_APP_LIST_START_SPEECH_RECOGNITION),
31 l10n_util::GetStringUTF16(IDS_TOOLTIP_MIC_SEARCH)));
31 } 32 }
32 33
33 } // namespace 34 } // namespace
34 35
35 SearchResourceManager::SearchResourceManager(Profile* profile, 36 SearchResourceManager::SearchResourceManager(Profile* profile,
36 SearchBoxModel* search_box, 37 SearchBoxModel* search_box,
37 SpeechUIModel* speech_ui) 38 SpeechUIModel* speech_ui)
38 : search_box_(search_box), 39 : search_box_(search_box),
39 speech_ui_(speech_ui) { 40 speech_ui_(speech_ui) {
40 speech_ui_->AddObserver(this); 41 speech_ui_->AddObserver(this);
(...skipping 11 matching lines...) Expand all
52 53
53 void SearchResourceManager::OnSpeechRecognitionStateChanged( 54 void SearchResourceManager::OnSpeechRecognitionStateChanged(
54 SpeechRecognitionState new_state) { 55 SpeechRecognitionState new_state) {
55 search_box_->SetHintText(l10n_util::GetStringUTF16( 56 search_box_->SetHintText(l10n_util::GetStringUTF16(
56 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ? 57 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ?
57 IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT)); 58 IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT));
58 search_box_->SetSpeechRecognitionButton(CreateNewProperty(new_state)); 59 search_box_->SetSpeechRecognitionButton(CreateNewProperty(new_state));
59 } 60 }
60 61
61 } // namespace app_list 62 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/search_box_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698