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/arc_app_deferred_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" |
6 | 6 |
7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
8 #include "chrome/browser/chromeos/arc/arc_util.h" | 8 #include "chrome/browser/chromeos/arc/arc_util.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 DCHECK(arc_session_manager); | 190 DCHECK(arc_session_manager); |
191 DCHECK(arc_session_manager->state() != | 191 DCHECK(arc_session_manager->state() != |
192 arc::ArcSessionManager::State::STOPPED); | 192 arc::ArcSessionManager::State::STOPPED); |
193 DCHECK(arc_session_manager->state() != | 193 DCHECK(arc_session_manager->state() != |
194 arc::ArcSessionManager::State::NOT_INITIALIZED); | 194 arc::ArcSessionManager::State::NOT_INITIALIZED); |
195 | 195 |
196 const std::string shelf_app_id = | 196 const std::string shelf_app_id = |
197 ArcAppWindowLauncherController::GetShelfAppIdFromArcAppId(app_id); | 197 ArcAppWindowLauncherController::GetShelfAppIdFromArcAppId(app_id); |
198 const ash::ShelfID shelf_id = owner_->GetShelfIDForAppID(shelf_app_id); | 198 const ash::ShelfID shelf_id = owner_->GetShelfIDForAppID(shelf_app_id); |
199 | 199 |
200 // We are allowed to apply new deferred controller only over shortcut. | 200 // We are allowed to apply new deferred controller only over non-active items. |
201 const ash::ShelfItem* item = owner_->GetItem(shelf_id); | 201 const ash::ShelfItem* item = owner_->GetItem(shelf_id); |
202 if (item && item->type != ash::TYPE_APP_SHORTCUT) | 202 if (item && item->status != ash::STATUS_CLOSED) |
203 return; | 203 return; |
204 | 204 |
205 ArcAppDeferredLauncherItemController* controller = | 205 ArcAppDeferredLauncherItemController* controller = |
206 new ArcAppDeferredLauncherItemController( | 206 new ArcAppDeferredLauncherItemController( |
207 shelf_app_id, owner_, event_flags, weak_ptr_factory_.GetWeakPtr()); | 207 shelf_app_id, owner_, event_flags, weak_ptr_factory_.GetWeakPtr()); |
208 if (shelf_id == 0) { | 208 if (shelf_id == 0) { |
209 owner_->CreateAppLauncherItem(controller, shelf_app_id, | 209 owner_->CreateAppLauncherItem(controller, shelf_app_id, |
210 ash::STATUS_RUNNING); | 210 ash::STATUS_RUNNING); |
211 } else { | 211 } else { |
212 owner_->SetItemController(shelf_id, controller); | 212 owner_->SetItemController(shelf_id, controller); |
213 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); | 213 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); |
214 } | 214 } |
215 | 215 |
216 if (app_controller_map_.empty()) | 216 if (app_controller_map_.empty()) |
217 RegisterNextUpdate(); | 217 RegisterNextUpdate(); |
218 | 218 |
219 app_controller_map_[shelf_app_id] = controller; | 219 app_controller_map_[shelf_app_id] = controller; |
220 } | 220 } |
OLD | NEW |