Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.cc

Issue 2545923004: Remove LauncherItemController::type; use ShelfItems::type. (Closed)
Patch Set: Update tests; fix test item running status. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 DCHECK(arc_session_manager); 185 DCHECK(arc_session_manager);
186 DCHECK(arc_session_manager->state() != 186 DCHECK(arc_session_manager->state() !=
187 arc::ArcSessionManager::State::STOPPED); 187 arc::ArcSessionManager::State::STOPPED);
188 DCHECK(arc_session_manager->state() != 188 DCHECK(arc_session_manager->state() !=
189 arc::ArcSessionManager::State::NOT_INITIALIZED); 189 arc::ArcSessionManager::State::NOT_INITIALIZED);
190 190
191 const std::string shelf_app_id = 191 const std::string shelf_app_id =
192 ArcAppWindowLauncherController::GetShelfAppIdFromArcAppId(app_id); 192 ArcAppWindowLauncherController::GetShelfAppIdFromArcAppId(app_id);
193 const ash::ShelfID shelf_id = owner_->GetShelfIDForAppID(shelf_app_id); 193 const ash::ShelfID shelf_id = owner_->GetShelfIDForAppID(shelf_app_id);
194 194
195 if (shelf_id) { 195 // We are allowed to apply new deferred controller only over shortcut.
196 LauncherItemController* controller = 196 if (shelf_id && owner_->GetItem(shelf_id).type != ash::TYPE_APP_SHORTCUT)
197 owner_->GetLauncherItemController(shelf_id); 197 return;
198 if (controller &&
199 controller->type() != LauncherItemController::TYPE_SHORTCUT) {
200 // We are allowed to apply new deferred controller only over shortcut.
201 return;
202 }
203 }
204 198
205 ArcAppDeferredLauncherItemController* controller = 199 ArcAppDeferredLauncherItemController* controller =
206 new ArcAppDeferredLauncherItemController(shelf_app_id, owner_, 200 new ArcAppDeferredLauncherItemController(shelf_app_id, owner_,
207 weak_ptr_factory_.GetWeakPtr()); 201 weak_ptr_factory_.GetWeakPtr());
208 if (shelf_id == 0) { 202 if (shelf_id == 0) {
209 owner_->CreateAppLauncherItem(controller, shelf_app_id, 203 owner_->CreateAppLauncherItem(controller, shelf_app_id,
210 ash::STATUS_RUNNING); 204 ash::STATUS_RUNNING);
211 } else { 205 } else {
212 owner_->SetItemController(shelf_id, controller); 206 owner_->SetItemController(shelf_id, controller);
213 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); 207 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
214 } 208 }
215 209
216 if (app_controller_map_.empty()) 210 if (app_controller_map_.empty())
217 RegisterNextUpdate(); 211 RegisterNextUpdate();
218 212
219 app_controller_map_[shelf_app_id] = controller; 213 app_controller_map_[shelf_app_id] = controller;
220 } 214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698