| OLD | NEW |
| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 442 } |
| 443 | 443 |
| 444 void ChromeLauncherControllerImpl::Launch(ash::ShelfID id, int event_flags) { | 444 void ChromeLauncherControllerImpl::Launch(ash::ShelfID id, int event_flags) { |
| 445 LauncherItemController* controller = GetLauncherItemController(id); | 445 LauncherItemController* controller = GetLauncherItemController(id); |
| 446 if (!controller) | 446 if (!controller) |
| 447 return; // In case invoked from menu and item closed while menu up. | 447 return; // In case invoked from menu and item closed while menu up. |
| 448 controller->Launch(ash::LAUNCH_FROM_UNKNOWN, event_flags); | 448 controller->Launch(ash::LAUNCH_FROM_UNKNOWN, event_flags); |
| 449 } | 449 } |
| 450 | 450 |
| 451 void ChromeLauncherControllerImpl::Close(ash::ShelfID id) { | 451 void ChromeLauncherControllerImpl::Close(ash::ShelfID id) { |
| 452 LauncherItemController* controller = GetLauncherItemController(id); | 452 ash::ShelfItemDelegate* delegate = model_->GetShelfItemDelegate(id); |
| 453 if (!controller) | 453 if (!delegate) |
| 454 return; // May happen if menu closed. | 454 return; // May happen if menu closed. |
| 455 controller->Close(); | 455 delegate->Close(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 bool ChromeLauncherControllerImpl::IsOpen(ash::ShelfID id) { | 458 bool ChromeLauncherControllerImpl::IsOpen(ash::ShelfID id) { |
| 459 LauncherItemController* controller = GetLauncherItemController(id); | 459 ash::ShelfItemDelegate* delegate = model_->GetShelfItemDelegate(id); |
| 460 if (!controller) | 460 return delegate && delegate->IsOpen(); |
| 461 return false; | |
| 462 return controller->IsOpen(); | |
| 463 } | 461 } |
| 464 | 462 |
| 465 bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) { | 463 bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) { |
| 466 if (!HasShelfIDToAppIDMapping(id)) | 464 if (!HasShelfIDToAppIDMapping(id)) |
| 467 return false; | 465 return false; |
| 468 | 466 |
| 469 std::string app_id = GetAppIDForShelfID(id); | 467 std::string app_id = GetAppIDForShelfID(id); |
| 470 const Extension* extension = GetExtensionForAppID(app_id, profile()); | 468 const Extension* extension = GetExtensionForAppID(app_id, profile()); |
| 471 // An extension can be synced / updated at any time and therefore not be | 469 // An extension can be synced / updated at any time and therefore not be |
| 472 // available. | 470 // available. |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 if (index == -1) | 1563 if (index == -1) |
| 1566 continue; | 1564 continue; |
| 1567 ash::ShelfItem item = model_->items()[index]; | 1565 ash::ShelfItem item = model_->items()[index]; |
| 1568 item.image = image; | 1566 item.image = image; |
| 1569 if (arc_deferred_launcher_) | 1567 if (arc_deferred_launcher_) |
| 1570 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); | 1568 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); |
| 1571 model_->Set(index, item); | 1569 model_->Set(index, item); |
| 1572 // It's possible we're waiting on more than one item, so don't break. | 1570 // It's possible we're waiting on more than one item, so don't break. |
| 1573 } | 1571 } |
| 1574 } | 1572 } |
| OLD | NEW |