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