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.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 launchers_.insert(launcher); | 1090 launchers_.insert(launcher); |
1091 launcher->shelf_widget()->shelf_layout_manager()->AddObserver(this); | 1091 launcher->shelf_widget()->shelf_layout_manager()->AddObserver(this); |
1092 } | 1092 } |
1093 | 1093 |
1094 void ChromeLauncherController::OnLauncherDestroyed(ash::Launcher* launcher) { | 1094 void ChromeLauncherController::OnLauncherDestroyed(ash::Launcher* launcher) { |
1095 launchers_.erase(launcher); | 1095 launchers_.erase(launcher); |
1096 // RemoveObserver is not called here, since by the time this method is called | 1096 // RemoveObserver is not called here, since by the time this method is called |
1097 // Launcher is already in its destructor. | 1097 // Launcher is already in its destructor. |
1098 } | 1098 } |
1099 | 1099 |
1100 void ChromeLauncherController::LauncherItemAdded(int index) { | 1100 void ChromeLauncherController::ShelfItemAdded(int index) { |
1101 // The app list launcher can get added to the shelf after we applied the | 1101 // The app list launcher can get added to the shelf after we applied the |
1102 // preferences. In that case the item might be at the wrong spot. As such we | 1102 // preferences. In that case the item might be at the wrong spot. As such we |
1103 // call the function again. | 1103 // call the function again. |
1104 if (model_->items()[index].type == ash::TYPE_APP_LIST && | 1104 if (model_->items()[index].type == ash::TYPE_APP_LIST && |
1105 ash::switches::UseAlternateShelfLayout()) | 1105 ash::switches::UseAlternateShelfLayout()) |
1106 UpdateAppLaunchersFromPref(); | 1106 UpdateAppLaunchersFromPref(); |
1107 } | 1107 } |
1108 | 1108 |
1109 void ChromeLauncherController::LauncherItemRemoved(int index, | 1109 void ChromeLauncherController::ShelfItemRemoved(int index, ash::LauncherID id) { |
1110 ash::LauncherID id) { | |
1111 } | 1110 } |
1112 | 1111 |
1113 void ChromeLauncherController::LauncherItemMoved(int start_index, | 1112 void ChromeLauncherController::ShelfItemMoved(int start_index, |
1114 int target_index) { | 1113 int target_index) { |
1115 const ash::LauncherItem& item = model_->items()[target_index]; | 1114 const ash::LauncherItem& item = model_->items()[target_index]; |
1116 // We remember the moved item position if it is either pinnable or | 1115 // We remember the moved item position if it is either pinnable or |
1117 // it is the app list with the alternate shelf layout. | 1116 // it is the app list with the alternate shelf layout. |
1118 if ((HasItemController(item.id) && IsPinned(item.id)) || | 1117 if ((HasItemController(item.id) && IsPinned(item.id)) || |
1119 (ash::switches::UseAlternateShelfLayout() && | 1118 (ash::switches::UseAlternateShelfLayout() && |
1120 item.type == ash::TYPE_APP_LIST)) | 1119 item.type == ash::TYPE_APP_LIST)) |
1121 PersistPinnedState(); | 1120 PersistPinnedState(); |
1122 } | 1121 } |
1123 | 1122 |
1124 void ChromeLauncherController::LauncherItemChanged( | 1123 void ChromeLauncherController::ShelfItemChanged( |
1125 int index, | 1124 int index, |
1126 const ash::LauncherItem& old_item) { | 1125 const ash::LauncherItem& old_item) { |
1127 } | 1126 } |
1128 | 1127 |
1129 void ChromeLauncherController::LauncherStatusChanged() { | 1128 void ChromeLauncherController::ShelfStatusChanged() { |
1130 } | 1129 } |
1131 | 1130 |
1132 void ChromeLauncherController::ActiveUserChanged( | 1131 void ChromeLauncherController::ActiveUserChanged( |
1133 const std::string& user_email) { | 1132 const std::string& user_email) { |
1134 // Coming here the default profile is already switched. All profile specific | 1133 // Coming here the default profile is already switched. All profile specific |
1135 // resources get released and the new profile gets attached instead. | 1134 // resources get released and the new profile gets attached instead. |
1136 ReleaseProfile(); | 1135 ReleaseProfile(); |
1137 AttachProfile(ProfileManager::GetDefaultProfile()); | 1136 AttachProfile(ProfileManager::GetDefaultProfile()); |
1138 // Update the V1 applications. | 1137 // Update the V1 applications. |
1139 browser_status_monitor_->ActiveUserChanged(user_email); | 1138 browser_status_monitor_->ActiveUserChanged(user_email); |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 } | 2057 } |
2059 } | 2058 } |
2060 } | 2059 } |
2061 } | 2060 } |
2062 | 2061 |
2063 // Finally we update the browser state itself. | 2062 // Finally we update the browser state itself. |
2064 browser_status_monitor_->UpdateBrowserItemState(); | 2063 browser_status_monitor_->UpdateBrowserItemState(); |
2065 #endif | 2064 #endif |
2066 } | 2065 } |
2067 | 2066 |
OLD | NEW |