| 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" |
| 11 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
| 13 #include "base/command_line.h" | |
| 14 #include "chrome/browser/app_mode/app_mode_utils.h" | 13 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 15 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/profiles/profiles_state.h" |
| 17 #include "chrome/browser/ui/app_list/app_list_service.h" | 17 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 18 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 18 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| 19 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" | 19 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
| 20 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" | 20 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" |
| 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 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 "chrome/common/chrome_switches.h" | |
| 25 #include "components/signin/core/common/profile_management_switches.h" | 24 #include "components/signin/core/common/profile_management_switches.h" |
| 26 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 27 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 29 | 28 |
| 30 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 32 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | 31 #include "chrome/browser/chromeos/display/display_configuration_observer.h" |
| 33 #include "chrome/browser/chromeos/login/user_manager.h" | 32 #include "chrome/browser/chromeos/login/user_manager.h" |
| 34 #endif | 33 #endif |
| 35 | 34 |
| 36 // static | 35 // static |
| 37 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 36 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
| 38 | 37 |
| 39 ChromeShellDelegate::ChromeShellDelegate() | 38 ChromeShellDelegate::ChromeShellDelegate() |
| 40 : shelf_delegate_(NULL) { | 39 : shelf_delegate_(NULL) { |
| 41 instance_ = this; | 40 instance_ = this; |
| 42 PlatformInit(); | 41 PlatformInit(); |
| 43 } | 42 } |
| 44 | 43 |
| 45 ChromeShellDelegate::~ChromeShellDelegate() { | 44 ChromeShellDelegate::~ChromeShellDelegate() { |
| 46 if (instance_ == this) | 45 if (instance_ == this) |
| 47 instance_ = NULL; | 46 instance_ = NULL; |
| 48 } | 47 } |
| 49 | 48 |
| 50 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { | 49 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { |
| 51 // TODO(skuhne): There is a function named profiles::IsMultiProfilesEnabled | 50 if (!profiles::IsMultipleProfilesEnabled()) |
| 52 // which does similar things - but it is not the same. We should investigate | |
| 53 // if these two could be folded together. | |
| 54 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles)) | |
| 55 return false; | 51 return false; |
| 56 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
| 57 // 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 |
| 58 // simultaneous users to allow this feature. | 54 // simultaneous users to allow this feature. |
| 59 if (!chromeos::UserManager::IsInitialized()) | 55 if (!chromeos::UserManager::IsInitialized()) |
| 60 return false; | 56 return false; |
| 61 size_t admitted_users_to_be_added = | 57 size_t admitted_users_to_be_added = |
| 62 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile().size(); | 58 chromeos::UserManager::Get()->GetUsersAdmittedForMultiProfile().size(); |
| 63 size_t logged_in_users = | 59 size_t logged_in_users = |
| 64 chromeos::UserManager::Get()->GetLoggedInUsers().size(); | 60 chromeos::UserManager::Get()->GetLoggedInUsers().size(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 161 |
| 166 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( | 162 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( |
| 167 ash::VirtualKeyboardStateObserver* observer) { | 163 ash::VirtualKeyboardStateObserver* observer) { |
| 168 keyboard_state_observer_list_.AddObserver(observer); | 164 keyboard_state_observer_list_.AddObserver(observer); |
| 169 } | 165 } |
| 170 | 166 |
| 171 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( | 167 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( |
| 172 ash::VirtualKeyboardStateObserver* observer) { | 168 ash::VirtualKeyboardStateObserver* observer) { |
| 173 keyboard_state_observer_list_.RemoveObserver(observer); | 169 keyboard_state_observer_list_.RemoveObserver(observer); |
| 174 } | 170 } |
| OLD | NEW |