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/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
8 #include "ash/wm/window_properties.h" | 8 #include "ash/wm/window_properties.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "ash/wm_window.h" | 10 #include "ash/wm_window.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 14 #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" | 15 #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" | 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
17 #include "extensions/browser/app_window/app_window.h" | 17 #include "extensions/browser/app_window/app_window.h" |
18 #include "extensions/browser/app_window/native_app_window.h" | 18 #include "extensions/browser/app_window/native_app_window.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
21 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
22 | 22 |
23 using extensions::AppWindow; | 23 using extensions::AppWindow; |
24 using extensions::AppWindowRegistry; | 24 using extensions::AppWindowRegistry; |
(...skipping 18 matching lines...) Expand all Loading... |
43 std::string GetAppShelfId(AppWindow* app_window) { | 43 std::string GetAppShelfId(AppWindow* app_window) { |
44 // Set app_shelf_id value to app_id and then append launch_id. | 44 // Set app_shelf_id value to app_id and then append launch_id. |
45 std::string app_id = app_window->extension_id(); | 45 std::string app_id = app_window->extension_id(); |
46 std::string launch_id = GetLaunchId(app_window); | 46 std::string launch_id = GetLaunchId(app_window); |
47 return app_id + launch_id; | 47 return app_id + launch_id; |
48 } | 48 } |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 ExtensionAppWindowLauncherController::ExtensionAppWindowLauncherController( | 52 ExtensionAppWindowLauncherController::ExtensionAppWindowLauncherController( |
53 ChromeLauncherControllerImpl* owner) | 53 ChromeLauncherController* owner) |
54 : AppWindowLauncherController(owner) { | 54 : AppWindowLauncherController(owner) { |
55 AppWindowRegistry* registry = AppWindowRegistry::Get(owner->profile()); | 55 AppWindowRegistry* registry = AppWindowRegistry::Get(owner->profile()); |
56 registry_.insert(registry); | 56 registry_.insert(registry); |
57 registry->AddObserver(this); | 57 registry->AddObserver(this); |
58 } | 58 } |
59 | 59 |
60 ExtensionAppWindowLauncherController::~ExtensionAppWindowLauncherController() { | 60 ExtensionAppWindowLauncherController::~ExtensionAppWindowLauncherController() { |
61 for (std::set<AppWindowRegistry*>::iterator it = registry_.begin(); | 61 for (std::set<AppWindowRegistry*>::iterator it = registry_.begin(); |
62 it != registry_.end(); ++it) | 62 it != registry_.end(); ++it) |
63 (*it)->RemoveObserver(this); | 63 (*it)->RemoveObserver(this); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 WindowToAppShelfIdMap::iterator window_iter = | 228 WindowToAppShelfIdMap::iterator window_iter = |
229 window_to_app_shelf_id_map_.find(window); | 229 window_to_app_shelf_id_map_.find(window); |
230 if (window_iter == window_to_app_shelf_id_map_.end()) | 230 if (window_iter == window_to_app_shelf_id_map_.end()) |
231 return nullptr; | 231 return nullptr; |
232 AppControllerMap::iterator app_controller_iter = | 232 AppControllerMap::iterator app_controller_iter = |
233 app_controller_map_.find(window_iter->second); | 233 app_controller_map_.find(window_iter->second); |
234 if (app_controller_iter == app_controller_map_.end()) | 234 if (app_controller_iter == app_controller_map_.end()) |
235 return nullptr; | 235 return nullptr; |
236 return app_controller_iter->second; | 236 return app_controller_iter->second; |
237 } | 237 } |
OLD | NEW |