| 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 "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "ash/content_support/gpu_support_impl.h" | 9 #include "ash/content_support/gpu_support_impl.h" |
| 10 #include "ash/magnifier/magnifier_constants.h" | 10 #include "ash/magnifier/magnifier_constants.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { | 49 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { |
| 50 if (!profiles::IsMultipleProfilesEnabled()) | 50 if (!profiles::IsMultipleProfilesEnabled()) |
| 51 return false; | 51 return false; |
| 52 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
| 53 // If there is a user manager, we need to see that we can at least have 2 | 53 // If there is a user manager, we need to see that we can at least have 2 |
| 54 // simultaneous users to allow this feature. | 54 // simultaneous users to allow this feature. |
| 55 if (!chromeos::UserManager::IsInitialized()) | 55 if (!chromeos::UserManager::IsInitialized()) |
| 56 return false; | 56 return false; |
| 57 size_t admitted_users_to_be_added = | 57 size_t admitted_users_to_be_added = |
| 58 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile().size(); | 58 chromeos::GetUserManager()->GetUsersAdmittedForMultiProfile().size(); |
| 59 size_t logged_in_users = | 59 size_t logged_in_users = |
| 60 chromeos::UserManager::Get()->GetLoggedInUsers().size(); | 60 chromeos::GetUserManager()->GetLoggedInUsers().size(); |
| 61 if (!logged_in_users) { | 61 if (!logged_in_users) { |
| 62 // The shelf gets created on the login screen and as such we have to create | 62 // The shelf gets created on the login screen and as such we have to create |
| 63 // all multi profile items of the the system tray menu before the user logs | 63 // all multi profile items of the the system tray menu before the user logs |
| 64 // in. For special cases like Kiosk mode and / or guest mode this isn't a | 64 // in. For special cases like Kiosk mode and / or guest mode this isn't a |
| 65 // problem since either the browser gets restarted and / or the flag is not | 65 // problem since either the browser gets restarted and / or the flag is not |
| 66 // allowed, but for an "ephermal" user (see crbug.com/312324) it is not | 66 // allowed, but for an "ephermal" user (see crbug.com/312324) it is not |
| 67 // decided yet if he could add other users to his session or not. | 67 // decided yet if he could add other users to his session or not. |
| 68 // TODO(skuhne): As soon as the issue above needs to be resolved, this logic | 68 // TODO(skuhne): As soon as the issue above needs to be resolved, this logic |
| 69 // should change. | 69 // should change. |
| 70 logged_in_users = 1; | 70 logged_in_users = 1; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 92 #endif | 92 #endif |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void ChromeShellDelegate::Exit() { | 96 void ChromeShellDelegate::Exit() { |
| 97 chrome::AttemptUserExit(); | 97 chrome::AttemptUserExit(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() { | 100 content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() { |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 DCHECK(chromeos::UserManager::Get()->GetLoggedInUsers().size()); | 102 DCHECK(chromeos::GetUserManager()->GetLoggedInUsers().size()); |
| 103 #endif | 103 #endif |
| 104 return ProfileManager::GetActiveUserProfile(); | 104 return ProfileManager::GetActiveUserProfile(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 app_list::AppListViewDelegate* | 107 app_list::AppListViewDelegate* |
| 108 ChromeShellDelegate::CreateAppListViewDelegate() { | 108 ChromeShellDelegate::CreateAppListViewDelegate() { |
| 109 DCHECK(ash::Shell::HasInstance()); | 109 DCHECK(ash::Shell::HasInstance()); |
| 110 // Shell will own the created delegate, and the delegate will own | 110 // Shell will own the created delegate, and the delegate will own |
| 111 // the controller. | 111 // the controller. |
| 112 return new AppListViewDelegate( | 112 return new AppListViewDelegate( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( | 162 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( |
| 163 ash::VirtualKeyboardStateObserver* observer) { | 163 ash::VirtualKeyboardStateObserver* observer) { |
| 164 keyboard_state_observer_list_.AddObserver(observer); | 164 keyboard_state_observer_list_.AddObserver(observer); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( | 167 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( |
| 168 ash::VirtualKeyboardStateObserver* observer) { | 168 ash::VirtualKeyboardStateObserver* observer) { |
| 169 keyboard_state_observer_list_.RemoveObserver(observer); | 169 keyboard_state_observer_list_.RemoveObserver(observer); |
| 170 } | 170 } |
| OLD | NEW |