summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/shell/app_list.cc3
-rw-r--r--athena/home/app_list_view_delegate.cc3
-rw-r--r--chrome/browser/ui/app_list/app_list_view_delegate.cc24
-rw-r--r--ui/app_list/speech_ui_model.cc9
-rw-r--r--ui/app_list/speech_ui_model.h3
-rw-r--r--ui/app_list/test/app_list_test_view_delegate.cc3
6 files changed, 24 insertions, 21 deletions
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc
index bf5a44b..1c00f2b 100644
--- a/ash/shell/app_list.cc
+++ b/ash/shell/app_list.cc
@@ -197,8 +197,7 @@ class ExampleSearchResult : public app_list::SearchResult {
class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
public:
ExampleAppListViewDelegate()
- : model_(new app_list::AppListModel),
- speech_ui_(app_list::SPEECH_RECOGNITION_OFF) {
+ : model_(new app_list::AppListModel) {
PopulateApps();
DecorateSearchBox(model_->search_box());
}
diff --git a/athena/home/app_list_view_delegate.cc b/athena/home/app_list_view_delegate.cc
index d4a7f53..116f1de 100644
--- a/athena/home/app_list_view_delegate.cc
+++ b/athena/home/app_list_view_delegate.cc
@@ -28,8 +28,7 @@ namespace athena {
AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder)
: model_(new app_list::AppListModel),
- speech_ui_(new app_list::SpeechUIModel(
- app_list::SPEECH_RECOGNITION_OFF)) {
+ speech_ui_(new app_list::SpeechUIModel) {
model_builder->PopulateApps(model_.get());
// TODO(mukai): get the text from the resources.
model_->search_box()->SetHintText(base::ASCIIToUTF16("Search"));
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index aefc78f..b7327ea 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -173,6 +173,13 @@ AppListViewDelegate::AppListViewDelegate(Profile* profile,
}
profile_manager->GetProfileInfoCache().AddObserver(this);
+ speech_ui_.reset(new app_list::SpeechUIModel);
+
+#if defined(GOOGLE_CHROME_BUILD)
+ speech_ui_->set_logo(
+ *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_APP_LIST_GOOGLE_LOGO_VOICE_SEARCH));
+#endif
SetProfile(profile);
}
@@ -191,7 +198,6 @@ void AppListViewDelegate::SetProfile(Profile* new_profile) {
// Note: |search_controller_| has a reference to |speech_ui_| so must be
// destroyed first.
search_controller_.reset();
- speech_ui_.reset();
custom_page_contents_.clear();
app_list::StartPageService* start_page_service =
app_list::StartPageService::Get(profile_);
@@ -204,8 +210,10 @@ void AppListViewDelegate::SetProfile(Profile* new_profile) {
}
profile_ = new_profile;
- if (!profile_)
+ if (!profile_) {
+ speech_ui_->SetSpeechRecognitionState(app_list::SPEECH_RECOGNITION_OFF);
return;
+ }
model_ =
app_list::AppListSyncableServiceFactory::GetForProfile(profile_)->model();
@@ -228,15 +236,9 @@ void AppListViewDelegate::SetUpSearchUI() {
if (start_page_service)
start_page_service->AddObserver(this);
- speech_ui_.reset(new app_list::SpeechUIModel(
- start_page_service ? start_page_service->state()
- : app_list::SPEECH_RECOGNITION_OFF));
-
-#if defined(GOOGLE_CHROME_BUILD)
- speech_ui_->set_logo(
- *ui::ResourceBundle::GetSharedInstance().
- GetImageSkiaNamed(IDR_APP_LIST_GOOGLE_LOGO_VOICE_SEARCH));
-#endif
+ speech_ui_->SetSpeechRecognitionState(start_page_service
+ ? start_page_service->state()
+ : app_list::SPEECH_RECOGNITION_OFF);
search_controller_.reset(new app_list::SearchController(profile_,
model_->search_box(),
diff --git a/ui/app_list/speech_ui_model.cc b/ui/app_list/speech_ui_model.cc
index 7f144db..57a123c 100644
--- a/ui/app_list/speech_ui_model.cc
+++ b/ui/app_list/speech_ui_model.cc
@@ -15,10 +15,13 @@ const int16 kDefaultSoundLevel = 200;
} // namespace
-SpeechUIModel::SpeechUIModel(SpeechRecognitionState initial_state)
- : state_(initial_state),
+SpeechUIModel::SpeechUIModel()
+ : is_final_(false),
+ sound_level_(0),
+ state_(app_list::SPEECH_RECOGNITION_OFF),
minimum_sound_level_(kDefaultSoundLevel),
- maximum_sound_level_(kDefaultSoundLevel) {}
+ maximum_sound_level_(kDefaultSoundLevel) {
+}
SpeechUIModel::~SpeechUIModel() {}
diff --git a/ui/app_list/speech_ui_model.h b/ui/app_list/speech_ui_model.h
index c89c4ba..aafd003 100644
--- a/ui/app_list/speech_ui_model.h
+++ b/ui/app_list/speech_ui_model.h
@@ -17,7 +17,8 @@ namespace app_list {
// SpeechUIModel provides the interface to update the UI for speech recognition.
class APP_LIST_EXPORT SpeechUIModel {
public:
- explicit SpeechUIModel(SpeechRecognitionState initial_state);
+ // Construct the model, initially in state SPEECH_RECOGNITION_OFF.
+ SpeechUIModel();
virtual ~SpeechUIModel();
void SetSpeechResult(const base::string16& result, bool is_final);
diff --git a/ui/app_list/test/app_list_test_view_delegate.cc b/ui/app_list/test/app_list_test_view_delegate.cc
index 56c2e8f..99b2cd2 100644
--- a/ui/app_list/test/app_list_test_view_delegate.cc
+++ b/ui/app_list/test/app_list_test_view_delegate.cc
@@ -23,8 +23,7 @@ AppListTestViewDelegate::AppListTestViewDelegate()
toggle_speech_recognition_count_(0),
open_search_result_count_(0),
next_profile_app_count_(0),
- model_(new AppListTestModel),
- speech_ui_(SPEECH_RECOGNITION_OFF) {
+ model_(new AppListTestModel) {
model_->SetFoldersEnabled(true);
}