OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |