OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/chromeos/arc/arc_util.h" | 34 #include "chrome/browser/chromeos/arc/arc_util.h" |
35 #include "chrome/browser/defaults.h" | 35 #include "chrome/browser/defaults.h" |
36 #include "chrome/browser/extensions/extension_util.h" | 36 #include "chrome/browser/extensions/extension_util.h" |
37 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 37 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
38 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 38 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
39 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
40 #include "chrome/browser/profiles/profile_manager.h" | 40 #include "chrome/browser/profiles/profile_manager.h" |
41 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 41 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
42 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 42 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
43 #include "chrome/browser/ui/ash/app_sync_ui_state.h" | 43 #include "chrome/browser/ui/ash/app_sync_ui_state.h" |
| 44 #include "chrome/browser/ui/ash/ash_util.h" |
44 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 45 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
45 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" | 46 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" |
46 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" | 47 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
47 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" | 48 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" |
48 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" | 49 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
49 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 50 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
50 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 51 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
51 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 52 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
52 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 53 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
53 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h" | 54 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 for (auto& controller : app_window_controllers_) | 532 for (auto& controller : app_window_controllers_) |
532 controller->ActiveUserChanged(user_email); | 533 controller->ActiveUserChanged(user_email); |
533 // Update the user specific shell properties from the new user profile. | 534 // Update the user specific shell properties from the new user profile. |
534 // Shelf preferences are loaded in ChromeLauncherController::AttachProfile. | 535 // Shelf preferences are loaded in ChromeLauncherController::AttachProfile. |
535 UpdateAppLaunchersFromPref(); | 536 UpdateAppLaunchersFromPref(); |
536 SetVirtualKeyboardBehaviorFromPrefs(); | 537 SetVirtualKeyboardBehaviorFromPrefs(); |
537 | 538 |
538 // Restore the order of running, but unpinned applications for the activated | 539 // Restore the order of running, but unpinned applications for the activated |
539 // user. | 540 // user. |
540 RestoreUnpinnedRunningApplicationOrder(user_email); | 541 RestoreUnpinnedRunningApplicationOrder(user_email); |
541 // Inform the system tray of the change. | 542 // TODO(crbug.com/557406): Fix this interaction pattern in Mash. |
542 ash::Shell::Get()->system_tray_delegate()->ActiveUserWasChanged(); | 543 if (!ash_util::IsRunningInMash()) { |
543 // Force on-screen keyboard to reset. | 544 // Inform the system tray of the change. |
544 if (keyboard::IsKeyboardEnabled()) | 545 ash::Shell::Get()->system_tray_delegate()->ActiveUserWasChanged(); |
545 ash::Shell::Get()->CreateKeyboard(); | 546 // Force on-screen keyboard to reset. |
| 547 if (keyboard::IsKeyboardEnabled()) |
| 548 ash::Shell::Get()->CreateKeyboard(); |
| 549 } |
546 } | 550 } |
547 | 551 |
548 void ChromeLauncherControllerImpl::AdditionalUserAddedToSession( | 552 void ChromeLauncherControllerImpl::AdditionalUserAddedToSession( |
549 Profile* profile) { | 553 Profile* profile) { |
550 // Switch the running applications to the new user. | 554 // Switch the running applications to the new user. |
551 for (auto& controller : app_window_controllers_) | 555 for (auto& controller : app_window_controllers_) |
552 controller->AdditionalUserAddedToSession(profile); | 556 controller->AdditionalUserAddedToSession(profile); |
553 } | 557 } |
554 | 558 |
555 ash::MenuItemList ChromeLauncherControllerImpl::GetAppMenuItemsForTesting( | 559 ash::MenuItemList ChromeLauncherControllerImpl::GetAppMenuItemsForTesting( |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 const bool was_enabled = keyboard::IsKeyboardEnabled(); | 1055 const bool was_enabled = keyboard::IsKeyboardEnabled(); |
1052 if (!service->HasPrefPath(prefs::kTouchVirtualKeyboardEnabled)) { | 1056 if (!service->HasPrefPath(prefs::kTouchVirtualKeyboardEnabled)) { |
1053 keyboard::SetKeyboardShowOverride(keyboard::KEYBOARD_SHOW_OVERRIDE_NONE); | 1057 keyboard::SetKeyboardShowOverride(keyboard::KEYBOARD_SHOW_OVERRIDE_NONE); |
1054 } else { | 1058 } else { |
1055 const bool enable = | 1059 const bool enable = |
1056 service->GetBoolean(prefs::kTouchVirtualKeyboardEnabled); | 1060 service->GetBoolean(prefs::kTouchVirtualKeyboardEnabled); |
1057 keyboard::SetKeyboardShowOverride( | 1061 keyboard::SetKeyboardShowOverride( |
1058 enable ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED | 1062 enable ? keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED |
1059 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED); | 1063 : keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED); |
1060 } | 1064 } |
1061 const bool is_enabled = keyboard::IsKeyboardEnabled(); | 1065 // TODO(crbug.com/557406): Fix this interaction pattern in Mash. |
1062 if (was_enabled && !is_enabled) | 1066 if (!ash_util::IsRunningInMash()) { |
1063 ash::Shell::Get()->DeactivateKeyboard(); | 1067 const bool is_enabled = keyboard::IsKeyboardEnabled(); |
1064 else if (is_enabled && !was_enabled) | 1068 if (was_enabled && !is_enabled) |
1065 ash::Shell::Get()->CreateKeyboard(); | 1069 ash::Shell::Get()->DeactivateKeyboard(); |
| 1070 else if (is_enabled && !was_enabled) |
| 1071 ash::Shell::Get()->CreateKeyboard(); |
| 1072 } |
1066 } | 1073 } |
1067 | 1074 |
1068 ash::ShelfItemStatus ChromeLauncherControllerImpl::GetAppState( | 1075 ash::ShelfItemStatus ChromeLauncherControllerImpl::GetAppState( |
1069 const std::string& app_id) { | 1076 const std::string& app_id) { |
1070 ash::ShelfItemStatus status = ash::STATUS_CLOSED; | 1077 ash::ShelfItemStatus status = ash::STATUS_CLOSED; |
1071 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); | 1078 for (WebContentsToAppIDMap::iterator it = web_contents_to_app_id_.begin(); |
1072 it != web_contents_to_app_id_.end(); ++it) { | 1079 it != web_contents_to_app_id_.end(); ++it) { |
1073 if (it->second == app_id) { | 1080 if (it->second == app_id) { |
1074 Browser* browser = chrome::FindBrowserWithWebContents(it->first); | 1081 Browser* browser = chrome::FindBrowserWithWebContents(it->first); |
1075 // Usually there should never be an item in our |web_contents_to_app_id_| | 1082 // Usually there should never be an item in our |web_contents_to_app_id_| |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 item.app_launch_id.app_id() != app_id) { | 1347 item.app_launch_id.app_id() != app_id) { |
1341 continue; | 1348 continue; |
1342 } | 1349 } |
1343 item.image = image; | 1350 item.image = image; |
1344 if (arc_deferred_launcher_) | 1351 if (arc_deferred_launcher_) |
1345 arc_deferred_launcher_->MaybeApplySpinningEffect(app_id, &item.image); | 1352 arc_deferred_launcher_->MaybeApplySpinningEffect(app_id, &item.image); |
1346 model_->Set(index, item); | 1353 model_->Set(index, item); |
1347 // It's possible we're waiting on more than one item, so don't break. | 1354 // It's possible we're waiting on more than one item, so don't break. |
1348 } | 1355 } |
1349 } | 1356 } |
OLD | NEW |