| 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_delegate.h" | 7 #include "ash/common/shelf/shelf_delegate.h" |
| 8 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shelf/shelf_util.h" | 9 #include "ash/shelf/shelf_util.h" |
| 9 #include "ash/shell.h" | |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.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.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" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 app_shelf_id_to_shelf_id_map_.find(app_shelf_id); | 156 app_shelf_id_to_shelf_id_map_.find(app_shelf_id); |
| 157 if (app_shelf_id_iter != app_shelf_id_to_shelf_id_map_.end()) { | 157 if (app_shelf_id_iter != app_shelf_id_to_shelf_id_map_.end()) { |
| 158 if (owner()->IsPinned(app_shelf_id_iter->second)) { | 158 if (owner()->IsPinned(app_shelf_id_iter->second)) { |
| 159 shelf_id = app_shelf_id_iter->second; | 159 shelf_id = app_shelf_id_iter->second; |
| 160 } else { | 160 } else { |
| 161 app_shelf_id_to_shelf_id_map_.erase(app_shelf_id); | 161 app_shelf_id_to_shelf_id_map_.erase(app_shelf_id); |
| 162 } | 162 } |
| 163 } else if (app_shelf_id == app_id) { | 163 } else if (app_shelf_id == app_id) { |
| 164 // show_in_shelf in false and not a panel | 164 // show_in_shelf in false and not a panel |
| 165 shelf_id = | 165 shelf_id = |
| 166 ash::Shell::GetInstance()->GetShelfDelegate()->GetShelfIDForAppID( | 166 ash::WmShell::Get()->shelf_delegate()->GetShelfIDForAppID(app_id); |
| 167 app_id); | |
| 168 // Check if the shelf_id corresponds to an already opened | 167 // Check if the shelf_id corresponds to an already opened |
| 169 // showInShelf=true window that has the same app_id. The current | 168 // showInShelf=true window that has the same app_id. The current |
| 170 // showInShelf=false window should not fold under this shelf item, | 169 // showInShelf=false window should not fold under this shelf item, |
| 171 // so the shelf_id is set to 0 to get a new shelf_id. | 170 // so the shelf_id is set to 0 to get a new shelf_id. |
| 172 auto&& id_map = app_shelf_id_to_shelf_id_map_; | 171 auto&& id_map = app_shelf_id_to_shelf_id_map_; |
| 173 if (std::find_if( | 172 if (std::find_if( |
| 174 id_map.begin(), id_map.end(), | 173 id_map.begin(), id_map.end(), |
| 175 [shelf_id](const AppShelfIdToShelfIdMap::value_type& pair) { | 174 [shelf_id](const AppShelfIdToShelfIdMap::value_type& pair) { |
| 176 return pair.second == shelf_id; | 175 return pair.second == shelf_id; |
| 177 }) != id_map.end()) { | 176 }) != id_map.end()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 WindowToAppShelfIdMap::iterator window_iter = | 239 WindowToAppShelfIdMap::iterator window_iter = |
| 241 window_to_app_shelf_id_map_.find(window); | 240 window_to_app_shelf_id_map_.find(window); |
| 242 if (window_iter == window_to_app_shelf_id_map_.end()) | 241 if (window_iter == window_to_app_shelf_id_map_.end()) |
| 243 return nullptr; | 242 return nullptr; |
| 244 AppControllerMap::iterator app_controller_iter = | 243 AppControllerMap::iterator app_controller_iter = |
| 245 app_controller_map_.find(window_iter->second); | 244 app_controller_map_.find(window_iter->second); |
| 246 if (app_controller_iter == app_controller_map_.end()) | 245 if (app_controller_iter == app_controller_map_.end()) |
| 247 return nullptr; | 246 return nullptr; |
| 248 return app_controller_iter->second; | 247 return app_controller_iter->second; |
| 249 } | 248 } |
| OLD | NEW |