| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/extension_app_window_launcher_controlle
r.h" | 5 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_controlle
r.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" |
| 7 #include "ash/common/shelf/shelf_delegate.h" | 8 #include "ash/common/shelf/shelf_delegate.h" |
| 8 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 9 #include "ash/shelf/shelf_util.h" | 10 #include "ash/common/wm_window_property.h" |
| 10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 15 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" | 16 #include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_cont
roller.h" |
| 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 17 #include "extensions/browser/app_window/app_window.h" | 18 #include "extensions/browser/app_window/app_window.h" |
| 18 #include "extensions/browser/app_window/native_app_window.h" | 19 #include "extensions/browser/app_window/native_app_window.h" |
| 19 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 21 #include "ui/aura/window.h" |
| 20 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
| 21 | 23 |
| 22 using extensions::AppWindow; | 24 using extensions::AppWindow; |
| 23 using extensions::AppWindowRegistry; | 25 using extensions::AppWindowRegistry; |
| 24 | 26 |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 std::string GetLaunchId(AppWindow* app_window) { | 29 std::string GetLaunchId(AppWindow* app_window) { |
| 28 // Set launch_id default value to an empty string. If showInShelf parameter | 30 // Set launch_id default value to an empty string. If showInShelf parameter |
| 29 // is true or the window type is panel and the window key is not empty, its | 31 // is true or the window type is panel and the window key is not empty, its |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 controller->set_image_set_by_controller(true); | 175 controller->set_image_set_by_controller(true); |
| 174 } | 176 } |
| 175 } else { | 177 } else { |
| 176 owner()->SetItemController(shelf_id, controller); | 178 owner()->SetItemController(shelf_id, controller); |
| 177 } | 179 } |
| 178 | 180 |
| 179 // We need to change the controller associated with app_shelf_id. | 181 // We need to change the controller associated with app_shelf_id. |
| 180 app_controller_map_[app_shelf_id] = controller; | 182 app_controller_map_[app_shelf_id] = controller; |
| 181 } | 183 } |
| 182 owner()->SetItemStatus(shelf_id, status); | 184 owner()->SetItemStatus(shelf_id, status); |
| 183 ash::SetShelfIDForWindow(shelf_id, window); | 185 ash::WmWindowAura::Get(window)->SetIntProperty( |
| 186 ash::WmWindowProperty::SHELF_ID, shelf_id); |
| 184 } | 187 } |
| 185 | 188 |
| 186 void ExtensionAppWindowLauncherController::UnregisterApp(aura::Window* window) { | 189 void ExtensionAppWindowLauncherController::UnregisterApp(aura::Window* window) { |
| 187 WindowToAppShelfIdMap::iterator window_iter = | 190 WindowToAppShelfIdMap::iterator window_iter = |
| 188 window_to_app_shelf_id_map_.find(window); | 191 window_to_app_shelf_id_map_.find(window); |
| 189 DCHECK(window_iter != window_to_app_shelf_id_map_.end()); | 192 DCHECK(window_iter != window_to_app_shelf_id_map_.end()); |
| 190 std::string app_shelf_id = window_iter->second; | 193 std::string app_shelf_id = window_iter->second; |
| 191 window_to_app_shelf_id_map_.erase(window_iter); | 194 window_to_app_shelf_id_map_.erase(window_iter); |
| 192 window->RemoveObserver(this); | 195 window->RemoveObserver(this); |
| 193 | 196 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 221 WindowToAppShelfIdMap::iterator window_iter = | 224 WindowToAppShelfIdMap::iterator window_iter = |
| 222 window_to_app_shelf_id_map_.find(window); | 225 window_to_app_shelf_id_map_.find(window); |
| 223 if (window_iter == window_to_app_shelf_id_map_.end()) | 226 if (window_iter == window_to_app_shelf_id_map_.end()) |
| 224 return nullptr; | 227 return nullptr; |
| 225 AppControllerMap::iterator app_controller_iter = | 228 AppControllerMap::iterator app_controller_iter = |
| 226 app_controller_map_.find(window_iter->second); | 229 app_controller_map_.find(window_iter->second); |
| 227 if (app_controller_iter == app_controller_map_.end()) | 230 if (app_controller_iter == app_controller_map_.end()) |
| 228 return nullptr; | 231 return nullptr; |
| 229 return app_controller_iter->second; | 232 return app_controller_iter->second; |
| 230 } | 233 } |
| OLD | NEW |