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

Unified Diff: chrome/browser/ui/app_list/app_list_view_delegate.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/home/app_list_view_delegate.cc ('k') | ui/app_list/speech_ui_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/app_list_view_delegate.cc
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 aefc78f93b1c5035d61c3abf1c71dd36c494e488..b7327eacb0087770dbae3129bc2520d0223a6f57 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(),
« no previous file with comments | « athena/home/app_list_view_delegate.cc ('k') | ui/app_list/speech_ui_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698