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

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 9829007: chromeos: Fix a crash when trying to open settings page when there is no browser window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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 | Annotate | Revision Log
« 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/chromeos/system/ash_system_tray_delegate.h" 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/system/audio/audio_observer.h" 9 #include "ash/system/audio/audio_observer.h"
10 #include "ash/system/bluetooth/bluetooth_observer.h" 10 #include "ash/system/bluetooth/bluetooth_observer.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 virtual void ChangeProxySettings() OVERRIDE { 411 virtual void ChangeProxySettings() OVERRIDE {
412 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); 412 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE);
413 BaseLoginDisplayHost::default_host()->OpenProxySettings(); 413 BaseLoginDisplayHost::default_host()->OpenProxySettings();
414 } 414 }
415 415
416 private: 416 private:
417 // Returns the last active browser. If there is no such browser, creates a new 417 // Returns the last active browser. If there is no such browser, creates a new
418 // browser window with an empty tab and returns it. 418 // browser window with an empty tab and returns it.
419 Browser* GetAppropriateBrowser() { 419 Browser* GetAppropriateBrowser() {
420 Browser* browser = BrowserList::GetLastActive(); 420 Browser* browser = BrowserList::GetLastActive();
421 if (!browser) 421 if (!browser) {
422 browser = Browser::NewEmptyWindow(ProfileManager::GetDefaultProfile()); 422 browser = Browser::OpenEmptyWindow(
423 ProfileManager::GetDefaultProfileOrOffTheRecord());
424 }
423 return browser; 425 return browser;
424 } 426 }
425 427
426 void SetProfile(Profile* profile) { 428 void SetProfile(Profile* profile) {
427 pref_registrar_.reset(new PrefChangeRegistrar); 429 pref_registrar_.reset(new PrefChangeRegistrar);
428 pref_registrar_->Init(profile->GetPrefs()); 430 pref_registrar_->Init(profile->GetPrefs());
429 pref_registrar_->Add(prefs::kUse24HourClock, this); 431 pref_registrar_->Add(prefs::kUse24HourClock, this);
430 UpdateClockType(profile->GetPrefs()); 432 UpdateClockType(profile->GetPrefs());
431 } 433 }
432 434
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 714 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
713 }; 715 };
714 716
715 } // namespace 717 } // namespace
716 718
717 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { 719 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) {
718 return new chromeos::SystemTrayDelegate(tray); 720 return new chromeos::SystemTrayDelegate(tray);
719 } 721 }
720 722
721 } // namespace chromeos 723 } // namespace chromeos
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