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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 2082933002: Fix crash in app list view delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 app_list::StartPageService* start_page_service = 248 app_list::StartPageService* start_page_service =
249 app_list::StartPageService::Get(profile_); 249 app_list::StartPageService::Get(profile_);
250 if (start_page_service) 250 if (start_page_service)
251 start_page_service->RemoveObserver(this); 251 start_page_service->RemoveObserver(this);
252 #if defined(USE_ASH) 252 #if defined(USE_ASH)
253 app_sync_ui_state_watcher_.reset(); 253 app_sync_ui_state_watcher_.reset();
254 #endif 254 #endif
255 model_ = NULL; 255 model_ = NULL;
256 } 256 }
257 257
258 template_url_service_observer_.RemoveAll();
259
258 profile_ = new_profile; 260 profile_ = new_profile;
259 if (!profile_) { 261 if (!profile_) {
260 speech_ui_->SetSpeechRecognitionState(app_list::SPEECH_RECOGNITION_OFF, 262 speech_ui_->SetSpeechRecognitionState(app_list::SPEECH_RECOGNITION_OFF,
261 false); 263 false);
262 return; 264 return;
263 } 265 }
264 266
265 // If we are in guest mode, the new profile should be an incognito profile. 267 // If we are in guest mode, the new profile should be an incognito profile.
266 // Otherwise, this may later hit a check (same condition as this one) in 268 // Otherwise, this may later hit a check (same condition as this one) in
267 // Browser::Browser when opening links in a browser window (see 269 // Browser::Browser when opening links in a browser window (see
268 // http://crbug.com/460437). 270 // http://crbug.com/460437).
269 DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord()) 271 DCHECK(!profile_->IsGuestSession() || profile_->IsOffTheRecord())
270 << "Guest mode must use incognito profile"; 272 << "Guest mode must use incognito profile";
271 273
272 { 274 {
273 // TODO(tapted): Remove ScopedTracker below once crbug.com/431326 is fixed. 275 // TODO(tapted): Remove ScopedTracker below once crbug.com/431326 is fixed.
274 tracked_objects::ScopedTracker tracking_profile( 276 tracked_objects::ScopedTracker tracking_profile(
275 FROM_HERE_WITH_EXPLICIT_FUNCTION( 277 FROM_HERE_WITH_EXPLICIT_FUNCTION(
276 "431326 AppListViewDelegate TemplateURL etc.")); 278 "431326 AppListViewDelegate TemplateURL etc."));
277 template_url_service_observer_.RemoveAll();
278 if (app_list::switches::IsExperimentalAppListEnabled()) { 279 if (app_list::switches::IsExperimentalAppListEnabled()) {
279 TemplateURLService* template_url_service = 280 TemplateURLService* template_url_service =
280 TemplateURLServiceFactory::GetForProfile(profile_); 281 TemplateURLServiceFactory::GetForProfile(profile_);
281 template_url_service_observer_.Add(template_url_service); 282 template_url_service_observer_.Add(template_url_service);
282 } 283 }
283 284
284 model_ = app_list::AppListSyncableServiceFactory::GetForProfile(profile_) 285 model_ = app_list::AppListSyncableServiceFactory::GetForProfile(profile_)
285 ->GetModel(); 286 ->GetModel();
286 287
287 #if defined(USE_ASH) 288 #if defined(USE_ASH)
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_, 849 FOR_EACH_OBSERVER(app_list::AppListViewDelegateObserver, observers_,
849 OnShutdown()); 850 OnShutdown());
850 851
851 SetProfile(nullptr); // Ensures launcher page web contents are torn down. 852 SetProfile(nullptr); // Ensures launcher page web contents are torn down.
852 853
853 // SigninManagerFactory is not a leaky singleton (unlike this class), and 854 // SigninManagerFactory is not a leaky singleton (unlike this class), and
854 // its destructor will check that it has no remaining observers. 855 // its destructor will check that it has no remaining observers.
855 scoped_observer_.RemoveAll(); 856 scoped_observer_.RemoveAll();
856 SigninManagerFactory::GetInstance()->RemoveObserver(this); 857 SigninManagerFactory::GetInstance()->RemoveObserver(this);
857 } 858 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698