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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 22 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
23 #include "chrome/browser/ui/browser_commands.h" | 23 #include "chrome/browser/ui/browser_commands.h" |
24 #include "components/signin/core/common/profile_management_switches.h" | 24 #include "components/signin/core/common/profile_management_switches.h" |
25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 | 28 |
29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
31 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | 31 #include "chrome/browser/chromeos/display/display_configuration_observer.h" |
32 #include "chrome/browser/chromeos/login/users/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
33 #endif | 33 #endif |
34 | 34 |
35 // static | 35 // static |
36 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 36 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
37 | 37 |
38 ChromeShellDelegate::ChromeShellDelegate() | 38 ChromeShellDelegate::ChromeShellDelegate() |
39 : shelf_delegate_(NULL) { | 39 : shelf_delegate_(NULL) { |
40 instance_ = this; | 40 instance_ = this; |
41 PlatformInit(); | 41 PlatformInit(); |
42 } | 42 } |
43 | 43 |
44 ChromeShellDelegate::~ChromeShellDelegate() { | 44 ChromeShellDelegate::~ChromeShellDelegate() { |
45 if (instance_ == this) | 45 if (instance_ == this) |
46 instance_ = NULL; | 46 instance_ = NULL; |
47 } | 47 } |
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 (!user_manager::UserManager::IsInitialized()) |
56 return false; | 56 return false; |
57 size_t admitted_users_to_be_added = | 57 size_t admitted_users_to_be_added = user_manager::UserManager::Get() |
58 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile().size(); | 58 ->GetUsersAdmittedForMultiProfile() |
| 59 .size(); |
59 size_t logged_in_users = | 60 size_t logged_in_users = |
60 chromeos::UserManager::Get()->GetLoggedInUsers().size(); | 61 user_manager::UserManager::Get()->GetLoggedInUsers().size(); |
61 if (!logged_in_users) { | 62 if (!logged_in_users) { |
62 // The shelf gets created on the login screen and as such we have to create | 63 // 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 | 64 // 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 | 65 // 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 | 66 // 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 | 67 // 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. | 68 // 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 | 69 // TODO(skuhne): As soon as the issue above needs to be resolved, this logic |
69 // should change. | 70 // should change. |
70 logged_in_users = 1; | 71 logged_in_users = 1; |
(...skipping 21 matching lines...) Expand all Loading... |
92 #endif | 93 #endif |
93 return false; | 94 return false; |
94 } | 95 } |
95 | 96 |
96 void ChromeShellDelegate::Exit() { | 97 void ChromeShellDelegate::Exit() { |
97 chrome::AttemptUserExit(); | 98 chrome::AttemptUserExit(); |
98 } | 99 } |
99 | 100 |
100 content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() { | 101 content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() { |
101 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
102 DCHECK(chromeos::UserManager::Get()->GetLoggedInUsers().size()); | 103 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); |
103 #endif | 104 #endif |
104 return ProfileManager::GetActiveUserProfile(); | 105 return ProfileManager::GetActiveUserProfile(); |
105 } | 106 } |
106 | 107 |
107 app_list::AppListViewDelegate* | 108 app_list::AppListViewDelegate* |
108 ChromeShellDelegate::CreateAppListViewDelegate() { | 109 ChromeShellDelegate::CreateAppListViewDelegate() { |
109 DCHECK(ash::Shell::HasInstance()); | 110 DCHECK(ash::Shell::HasInstance()); |
110 // Shell will own the created delegate, and the delegate will own | 111 // Shell will own the created delegate, and the delegate will own |
111 // the controller. | 112 // the controller. |
112 return new AppListViewDelegate( | 113 return new AppListViewDelegate( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 162 |
162 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( | 163 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( |
163 ash::VirtualKeyboardStateObserver* observer) { | 164 ash::VirtualKeyboardStateObserver* observer) { |
164 keyboard_state_observer_list_.AddObserver(observer); | 165 keyboard_state_observer_list_.AddObserver(observer); |
165 } | 166 } |
166 | 167 |
167 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( | 168 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( |
168 ash::VirtualKeyboardStateObserver* observer) { | 169 ash::VirtualKeyboardStateObserver* observer) { |
169 keyboard_state_observer_list_.RemoveObserver(observer); | 170 keyboard_state_observer_list_.RemoveObserver(observer); |
170 } | 171 } |
OLD | NEW |