Chromium Code Reviews| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 | 156 |
| 157 base::TimeDelta ArcAppDeferredLauncherController::GetActiveTime( | 157 base::TimeDelta ArcAppDeferredLauncherController::GetActiveTime( |
| 158 const std::string& app_id) const { | 158 const std::string& app_id) const { |
| 159 AppControllerMap::const_iterator it = app_controller_map_.find(app_id); | 159 AppControllerMap::const_iterator it = app_controller_map_.find(app_id); |
| 160 if (it == app_controller_map_.end()) | 160 if (it == app_controller_map_.end()) |
| 161 return base::TimeDelta(); | 161 return base::TimeDelta(); |
| 162 | 162 |
| 163 return it->second->GetActiveTime(); | 163 return it->second->GetActiveTime(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void ArcAppDeferredLauncherController::UpdateApp(const std::string& app_id) { | 166 void ArcAppDeferredLauncherController::UpdateApp(const std::string& app_id) { |
|
msw
2017/06/01 19:47:28
optional nit: rename UpdateShelfItemIcon or Update
khmel
2017/06/01 21:55:46
Done.
| |
| 167 AppIconLoader* icon_loader = owner_->GetAppIconLoaderForApp(app_id); | 167 owner_->UpdateLauncherItemImage(app_id); |
| 168 if (icon_loader) | |
| 169 icon_loader->UpdateImage(app_id); | |
| 170 } | 168 } |
| 171 | 169 |
| 172 void ArcAppDeferredLauncherController::UpdateApps() { | 170 void ArcAppDeferredLauncherController::UpdateApps() { |
| 173 if (app_controller_map_.empty()) | 171 if (app_controller_map_.empty()) |
| 174 return; | 172 return; |
| 175 | 173 |
| 176 RegisterNextUpdate(); | 174 RegisterNextUpdate(); |
| 177 for (const auto pair : app_controller_map_) | 175 for (const auto pair : app_controller_map_) |
| 178 UpdateApp(pair.first); | 176 UpdateApp(pair.first); |
| 179 } | 177 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 owner_->shelf_model()->SetShelfItemDelegate(shelf_id, | 211 owner_->shelf_model()->SetShelfItemDelegate(shelf_id, |
| 214 std::move(controller)); | 212 std::move(controller)); |
| 215 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); | 213 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); |
| 216 } | 214 } |
| 217 | 215 |
| 218 if (app_controller_map_.empty()) | 216 if (app_controller_map_.empty()) |
| 219 RegisterNextUpdate(); | 217 RegisterNextUpdate(); |
| 220 | 218 |
| 221 app_controller_map_[app_id] = item_controller; | 219 app_controller_map_[app_id] = item_controller; |
| 222 } | 220 } |
| OLD | NEW |