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

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

Issue 2487953003: Remove LauncherItemController::IsOpen, check ShelfItem::status. (Closed)
Patch Set: Cleanup. Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 controller->Launch(ash::LAUNCH_FROM_UNKNOWN, event_flags); 452 controller->Launch(ash::LAUNCH_FROM_UNKNOWN, event_flags);
453 } 453 }
454 454
455 void ChromeLauncherControllerImpl::Close(ash::ShelfID id) { 455 void ChromeLauncherControllerImpl::Close(ash::ShelfID id) {
456 LauncherItemController* controller = GetLauncherItemController(id); 456 LauncherItemController* controller = GetLauncherItemController(id);
457 if (!controller) 457 if (!controller)
458 return; // May happen if menu closed. 458 return; // May happen if menu closed.
459 controller->Close(); 459 controller->Close();
460 } 460 }
461 461
462 bool ChromeLauncherControllerImpl::IsOpen(ash::ShelfID id) { 462 bool ChromeLauncherControllerImpl::IsOpen(ash::ShelfID id) {
msw 2016/11/10 01:27:17 FYI, this is only used by ArcAppContextMenu::Build
463 LauncherItemController* controller = GetLauncherItemController(id); 463 const int index = model_->ItemIndexByID(id);
464 if (!controller) 464 return index >= 0 && model_->items()[index].status != ash::STATUS_CLOSED;
465 return false;
466 return controller->IsOpen();
467 } 465 }
468 466
469 bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) { 467 bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) {
470 if (!HasShelfIDToAppIDMapping(id)) 468 if (!HasShelfIDToAppIDMapping(id))
471 return false; 469 return false;
472 470
473 std::string app_id = GetAppIDForShelfID(id); 471 std::string app_id = GetAppIDForShelfID(id);
474 const Extension* extension = GetExtensionForAppID(app_id, profile()); 472 const Extension* extension = GetExtensionForAppID(app_id, profile());
475 // An extension can be synced / updated at any time and therefore not be 473 // An extension can be synced / updated at any time and therefore not be
476 // available. 474 // available.
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 if (index == -1) 1567 if (index == -1)
1570 continue; 1568 continue;
1571 ash::ShelfItem item = model_->items()[index]; 1569 ash::ShelfItem item = model_->items()[index];
1572 item.image = image; 1570 item.image = image;
1573 if (arc_deferred_launcher_) 1571 if (arc_deferred_launcher_)
1574 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); 1572 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image);
1575 model_->Set(index, item); 1573 model_->Set(index, item);
1576 // It's possible we're waiting on more than one item, so don't break. 1574 // It's possible we're waiting on more than one item, so don't break.
1577 } 1575 }
1578 } 1576 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698