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

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

Issue 550883002: Fix SpeechUIModel lifetime issue in Chrome's AppListViewDelegate when switching profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clear state for SetProfile(NULL) Created 6 years, 3 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 | « ui/app_list/speech_ui_model.h ('k') | ui/app_list/test/app_list_test_view_delegate.cc » ('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 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 "ui/app_list/speech_ui_model.h" 5 #include "ui/app_list/speech_ui_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace app_list { 9 namespace app_list {
10 10
11 namespace { 11 namespace {
12 12
13 // The default sound level, just gotten from the developer device. 13 // The default sound level, just gotten from the developer device.
14 const int16 kDefaultSoundLevel = 200; 14 const int16 kDefaultSoundLevel = 200;
15 15
16 } // namespace 16 } // namespace
17 17
18 SpeechUIModel::SpeechUIModel(SpeechRecognitionState initial_state) 18 SpeechUIModel::SpeechUIModel()
19 : state_(initial_state), 19 : is_final_(false),
20 sound_level_(0),
21 state_(app_list::SPEECH_RECOGNITION_OFF),
20 minimum_sound_level_(kDefaultSoundLevel), 22 minimum_sound_level_(kDefaultSoundLevel),
21 maximum_sound_level_(kDefaultSoundLevel) {} 23 maximum_sound_level_(kDefaultSoundLevel) {
24 }
22 25
23 SpeechUIModel::~SpeechUIModel() {} 26 SpeechUIModel::~SpeechUIModel() {}
24 27
25 void SpeechUIModel::SetSpeechResult(const base::string16& result, 28 void SpeechUIModel::SetSpeechResult(const base::string16& result,
26 bool is_final) { 29 bool is_final) {
27 if (result_ == result && is_final_ == is_final) 30 if (result_ == result && is_final_ == is_final)
28 return; 31 return;
29 32
30 result_ = result; 33 result_ = result;
31 is_final_ = is_final; 34 is_final_ = is_final;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 93
91 void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) { 94 void SpeechUIModel::AddObserver(SpeechUIModelObserver* observer) {
92 observers_.AddObserver(observer); 95 observers_.AddObserver(observer);
93 } 96 }
94 97
95 void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) { 98 void SpeechUIModel::RemoveObserver(SpeechUIModelObserver* observer) {
96 observers_.RemoveObserver(observer); 99 observers_.RemoveObserver(observer);
97 } 100 }
98 101
99 } // namespace app_list 102 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/speech_ui_model.h ('k') | ui/app_list/test/app_list_test_view_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698