| 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 "ash/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/chromeos/arc/arc_util.h" | 10 #include "chrome/browser/chromeos/arc/arc_util.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 // We are allowed to apply new deferred controller only over non-active items. | 202 // We are allowed to apply new deferred controller only over non-active items. |
| 203 const ash::ShelfItem* item = owner_->GetItem(shelf_id); | 203 const ash::ShelfItem* item = owner_->GetItem(shelf_id); |
| 204 if (item && item->status != ash::STATUS_CLOSED) | 204 if (item && item->status != ash::STATUS_CLOSED) |
| 205 return; | 205 return; |
| 206 | 206 |
| 207 std::unique_ptr<ArcAppDeferredLauncherItemController> controller = | 207 std::unique_ptr<ArcAppDeferredLauncherItemController> controller = |
| 208 base::MakeUnique<ArcAppDeferredLauncherItemController>( | 208 base::MakeUnique<ArcAppDeferredLauncherItemController>( |
| 209 shelf_app_id, event_flags, weak_ptr_factory_.GetWeakPtr()); | 209 shelf_app_id, event_flags, weak_ptr_factory_.GetWeakPtr()); |
| 210 ArcAppDeferredLauncherItemController* item_controller = controller.get(); | 210 ArcAppDeferredLauncherItemController* item_controller = controller.get(); |
| 211 if (item == nullptr) { | 211 if (!item) { |
| 212 owner_->CreateAppLauncherItem(std::move(controller), ash::STATUS_RUNNING); | 212 owner_->CreateAppLauncherItem(std::move(controller), ash::STATUS_RUNNING); |
| 213 } else { | 213 } else { |
| 214 owner_->shelf_model()->SetShelfItemDelegate(shelf_id, | 214 owner_->shelf_model()->SetShelfItemDelegate(shelf_id, |
| 215 std::move(controller)); | 215 std::move(controller)); |
| 216 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); | 216 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); |
| 217 } | 217 } |
| 218 | 218 |
| 219 if (app_controller_map_.empty()) | 219 if (app_controller_map_.empty()) |
| 220 RegisterNextUpdate(); | 220 RegisterNextUpdate(); |
| 221 | 221 |
| 222 app_controller_map_[shelf_app_id] = item_controller; | 222 app_controller_map_[shelf_app_id] = item_controller; |
| 223 } | 223 } |
| OLD | NEW |