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

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 2864453003: The user's profile might not be ready even if we have an active user (Closed)
Patch Set: Created 3 years, 7 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/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 554 }
555 555
556 gfx::Image ChromeShellDelegate::GetDeprecatedAcceleratorImage() const { 556 gfx::Image ChromeShellDelegate::GetDeprecatedAcceleratorImage() const {
557 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( 557 return ui::ResourceBundle::GetSharedInstance().GetImageNamed(
558 IDR_BLUETOOTH_KEYBOARD); 558 IDR_BLUETOOTH_KEYBOARD);
559 } 559 }
560 560
561 PrefService* ChromeShellDelegate::GetActiveUserPrefService() const { 561 PrefService* ChromeShellDelegate::GetActiveUserPrefService() const {
562 const user_manager::User* const user = 562 const user_manager::User* const user =
563 user_manager::UserManager::Get()->GetActiveUser(); 563 user_manager::UserManager::Get()->GetActiveUser();
564 return user ? chromeos::ProfileHelper::Get() 564 if (!user)
565 ->GetProfileByUser(user) 565 return nullptr;
566 ->GetPrefs() 566
567 : nullptr; 567 // The user's profile might not be ready yet, so we must check for that too.
568 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user);
569 return profile ? profile->GetPrefs() : nullptr;
568 } 570 }
569 571
570 bool ChromeShellDelegate::IsTouchscreenEnabledInPrefs( 572 bool ChromeShellDelegate::IsTouchscreenEnabledInPrefs(
571 bool use_local_state) const { 573 bool use_local_state) const {
572 return chromeos::system::InputDeviceSettings::Get() 574 return chromeos::system::InputDeviceSettings::Get()
573 ->IsTouchscreenEnabledInPrefs(use_local_state); 575 ->IsTouchscreenEnabledInPrefs(use_local_state);
574 } 576 }
575 577
576 void ChromeShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled, 578 void ChromeShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled,
577 bool use_local_state) { 579 bool use_local_state) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 NOTREACHED() << "Unexpected notification " << type; 645 NOTREACHED() << "Unexpected notification " << type;
644 } 646 }
645 } 647 }
646 648
647 void ChromeShellDelegate::PlatformInit() { 649 void ChromeShellDelegate::PlatformInit() {
648 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 650 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
649 content::NotificationService::AllSources()); 651 content::NotificationService::AllSources());
650 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, 652 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED,
651 content::NotificationService::AllSources()); 653 content::NotificationService::AllSources());
652 } 654 }
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