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

Side by Side Diff: ui/app_list/speech_ui_model.cc

Issue 105773004: Introduces the speech recognition UI to app_list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: start_page existence Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/app_list/speech_ui_model.h"
6
7 #include "ui/app_list/search_box_model.h"
8
9 namespace app_list {
10
11 SpeechUIModel::SpeechUIModel(SearchBoxModel* search_box)
12 : search_box_(search_box) {}
13
14 SpeechUIModel::~SpeechUIModel() {}
15
16 void SpeechUIModel::SetSpeechResult(const base::string16& result,
17 bool is_final) {
18 if (result_ == result && is_final_ == is_final)
19 return;
20
21 result_ = result;
22 is_final_ = is_final;
23 FOR_EACH_OBSERVER(SpeechUIModelObserver,
24 observers_,
25 OnSpeechResult(result, is_final));
26 if (is_final_)
27 search_box_->SetText(result);
28 }
29
30 void SpeechUIModel::UpdateSoundLevel(int16 level) {
31 if (sound_level_ == level)
32 return;
33
34 sound_level_ = level;
35 FOR_EACH_OBSERVER(SpeechUIModelObserver,
36 observers_,
37 OnSpeechSoundLevelChanged(level));
38 }
39
40 void SpeechUIModel::SetSpeechRecognitionState(
41 SpeechRecognitionState new_state) {
42 if (state_ == new_state)
43 return;
44
45 state_ = new_state;
46 FOR_EACH_OBSERVER(SpeechUIModelObserver,
47 observers_,
48 OnSpeechRecognitionStateChanged(new_state));
49 }
50
51 void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) {
52 observers_.AddObserver(observer);
53 }
54
55 void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) {
56 observers_.RemoveObserver(observer);
57 }
58
59 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698