| 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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) { | 1101 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) { |
| 1102 aura::Window* native_window = window->GetNativeWindow(); | 1102 aura::Window* native_window = window->GetNativeWindow(); |
| 1103 const std::string& current_user = | 1103 const std::string& current_user = |
| 1104 multi_user_util::GetUserIDFromProfile(profile()); | 1104 multi_user_util::GetUserIDFromProfile(profile()); |
| 1105 chrome::MultiUserWindowManager* manager = | 1105 chrome::MultiUserWindowManager* manager = |
| 1106 chrome::MultiUserWindowManager::GetInstance(); | 1106 chrome::MultiUserWindowManager::GetInstance(); |
| 1107 if (!manager->IsWindowOnDesktopOfUser(native_window, current_user)) { | 1107 if (!manager->IsWindowOnDesktopOfUser(native_window, current_user)) { |
| 1108 ash::MultiProfileUMA::RecordTeleportAction( | 1108 ash::MultiProfileUMA::RecordTeleportAction( |
| 1109 ash::MultiProfileUMA::TELEPORT_WINDOW_RETURN_BY_LAUNCHER); | 1109 ash::MultiProfileUMA::TELEPORT_WINDOW_RETURN_BY_LAUNCHER); |
| 1110 manager->ShowWindowForUser(native_window, current_user); | 1110 manager->ShowWindowForUser(native_window, current_user); |
| 1111 window->Activate(); | 1111 window->Activate(true /* user_gesture */); |
| 1112 return ash::ShelfItemDelegate::kExistingWindowActivated; | 1112 return ash::ShelfItemDelegate::kExistingWindowActivated; |
| 1113 } | 1113 } |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 if (window->IsActive() && allow_minimize) { | 1116 if (window->IsActive() && allow_minimize) { |
| 1117 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1117 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1118 switches::kDisableMinimizeOnSecondLauncherItemClick)) { | 1118 switches::kDisableMinimizeOnSecondLauncherItemClick)) { |
| 1119 AnimateWindow(window->GetNativeWindow(), | 1119 AnimateWindow(window->GetNativeWindow(), |
| 1120 wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 1120 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 1121 } else { | 1121 } else { |
| 1122 window->Minimize(); | 1122 window->Minimize(); |
| 1123 return ash::ShelfItemDelegate::kExistingWindowMinimized; | 1123 return ash::ShelfItemDelegate::kExistingWindowMinimized; |
| 1124 } | 1124 } |
| 1125 } else { | 1125 } else { |
| 1126 window->Show(); | 1126 window->Show(); |
| 1127 window->Activate(); | 1127 window->Activate(true /* user_gesture */); |
| 1128 return ash::ShelfItemDelegate::kExistingWindowActivated; | 1128 return ash::ShelfItemDelegate::kExistingWindowActivated; |
| 1129 } | 1129 } |
| 1130 return ash::ShelfItemDelegate::kNoAction; | 1130 return ash::ShelfItemDelegate::kNoAction; |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void ChromeLauncherController::OnShelfCreated(ash::Shelf* shelf) { | 1133 void ChromeLauncherController::OnShelfCreated(ash::Shelf* shelf) { |
| 1134 shelves_.insert(shelf); | 1134 shelves_.insert(shelf); |
| 1135 shelf->shelf_widget()->shelf_layout_manager()->AddObserver(this); | 1135 shelf->shelf_widget()->shelf_layout_manager()->AddObserver(this); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 void ChromeLauncherController::ReleaseProfile() { | 2139 void ChromeLauncherController::ReleaseProfile() { |
| 2140 if (app_sync_ui_state_) | 2140 if (app_sync_ui_state_) |
| 2141 app_sync_ui_state_->RemoveObserver(this); | 2141 app_sync_ui_state_->RemoveObserver(this); |
| 2142 | 2142 |
| 2143 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2143 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
| 2144 | 2144 |
| 2145 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2145 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); |
| 2146 | 2146 |
| 2147 pref_change_registrar_.RemoveAll(); | 2147 pref_change_registrar_.RemoveAll(); |
| 2148 } | 2148 } |
| OLD | NEW |