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

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: Rebase; remove new LauncherItemController::TYPE_APP check. 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 DCHECK(arc_session_manager); 188 DCHECK(arc_session_manager);
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 if (shelf_id) { 198 // We are allowed to apply new deferred controller only over shortcut.
199 LauncherItemController* controller = 199 if (shelf_id && owner_->GetItem(shelf_id).type != ash::TYPE_APP_SHORTCUT)
200 owner_->GetLauncherItemController(shelf_id); 200 return;
201 if (controller &&
202 controller->type() != LauncherItemController::TYPE_SHORTCUT) {
203 // We are allowed to apply new deferred controller only over shortcut.
204 return;
205 }
206 }
207 201
208 ArcAppDeferredLauncherItemController* controller = 202 ArcAppDeferredLauncherItemController* controller =
209 new ArcAppDeferredLauncherItemController( 203 new ArcAppDeferredLauncherItemController(
210 shelf_app_id, owner_, event_flags, weak_ptr_factory_.GetWeakPtr()); 204 shelf_app_id, owner_, event_flags, weak_ptr_factory_.GetWeakPtr());
211 if (shelf_id == 0) { 205 if (shelf_id == 0) {
212 owner_->CreateAppLauncherItem(controller, shelf_app_id, 206 owner_->CreateAppLauncherItem(controller, shelf_app_id,
213 ash::STATUS_RUNNING); 207 ash::STATUS_RUNNING);
214 } else { 208 } else {
215 owner_->SetItemController(shelf_id, controller); 209 owner_->SetItemController(shelf_id, controller);
216 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING); 210 owner_->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
217 } 211 }
218 212
219 if (app_controller_map_.empty()) 213 if (app_controller_map_.empty())
220 RegisterNextUpdate(); 214 RegisterNextUpdate();
221 215
222 app_controller_map_[shelf_app_id] = controller; 216 app_controller_map_[shelf_app_id] = controller;
223 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698