OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_window_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
6 | 6 |
7 #include "ash/shelf/shelf_util.h" | 7 #include "ash/shelf/shelf_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // Called from aura::Window::~Window(), before delegate_->OnWindowDestroyed() | 121 // Called from aura::Window::~Window(), before delegate_->OnWindowDestroyed() |
122 // which destroys AppWindow, so both |window| and the associated AppWindow | 122 // which destroys AppWindow, so both |window| and the associated AppWindow |
123 // are valid here. | 123 // are valid here. |
124 void AppWindowLauncherController::OnWindowDestroying(aura::Window* window) { | 124 void AppWindowLauncherController::OnWindowDestroying(aura::Window* window) { |
125 if (!ControlsWindow(window)) | 125 if (!ControlsWindow(window)) |
126 return; | 126 return; |
127 UnregisterApp(window); | 127 UnregisterApp(window); |
128 } | 128 } |
129 | 129 |
130 void AppWindowLauncherController::OnWindowActivated(aura::Window* new_active, | 130 void AppWindowLauncherController::OnWindowActivated( |
131 aura::Window* old_active) { | 131 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 132 aura::Window* new_active, |
| 133 aura::Window* old_active) { |
132 // Make the newly active window the active (first) entry in the controller. | 134 // Make the newly active window the active (first) entry in the controller. |
133 AppWindowLauncherItemController* new_controller = | 135 AppWindowLauncherItemController* new_controller = |
134 ControllerForWindow(new_active); | 136 ControllerForWindow(new_active); |
135 if (new_controller) { | 137 if (new_controller) { |
136 new_controller->SetActiveWindow(new_active); | 138 new_controller->SetActiveWindow(new_active); |
137 owner_->SetItemStatus(new_controller->shelf_id(), ash::STATUS_ACTIVE); | 139 owner_->SetItemStatus(new_controller->shelf_id(), ash::STATUS_ACTIVE); |
138 } | 140 } |
139 | 141 |
140 // Mark the old active window's launcher item as running (if different). | 142 // Mark the old active window's launcher item as running (if different). |
141 AppWindowLauncherItemController* old_controller = | 143 AppWindowLauncherItemController* old_controller = |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 WindowToAppShelfIdMap::iterator iter1 = | 235 WindowToAppShelfIdMap::iterator iter1 = |
234 window_to_app_shelf_id_map_.find(window); | 236 window_to_app_shelf_id_map_.find(window); |
235 if (iter1 == window_to_app_shelf_id_map_.end()) | 237 if (iter1 == window_to_app_shelf_id_map_.end()) |
236 return NULL; | 238 return NULL; |
237 std::string app_shelf_id = iter1->second; | 239 std::string app_shelf_id = iter1->second; |
238 AppControllerMap::iterator iter2 = app_controller_map_.find(app_shelf_id); | 240 AppControllerMap::iterator iter2 = app_controller_map_.find(app_shelf_id); |
239 if (iter2 == app_controller_map_.end()) | 241 if (iter2 == app_controller_map_.end()) |
240 return NULL; | 242 return NULL; |
241 return iter2->second; | 243 return iter2->second; |
242 } | 244 } |
OLD | NEW |