| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser_shortcut_launcher_item_controll
er.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shelf/shelf_model.h" | 9 #include "ash/shelf/shelf_model.h" |
| 10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 BrowserShortcutLauncherItemController:: | 67 BrowserShortcutLauncherItemController:: |
| 68 ~BrowserShortcutLauncherItemController() { | 68 ~BrowserShortcutLauncherItemController() { |
| 69 } | 69 } |
| 70 | 70 |
| 71 void BrowserShortcutLauncherItemController::UpdateBrowserItemState() { | 71 void BrowserShortcutLauncherItemController::UpdateBrowserItemState() { |
| 72 // The shell will not be available for win7_aura unittests like | 72 // The shell will not be available for win7_aura unittests like |
| 73 // ChromeLauncherControllerTest.BrowserMenuGeneration. | 73 // ChromeLauncherControllerTest.BrowserMenuGeneration. |
| 74 if (!ash::Shell::HasInstance()) | 74 if (!ash::Shell::HasInstance()) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 ash::ShelfModel* model = launcher_controller()->model(); | 77 ash::ShelfModel* model = ash::Shell::GetInstance()->shelf_model(); |
| 78 | 78 |
| 79 // Determine the new browser's active state and change if necessary. | 79 // Determine the new browser's active state and change if necessary. |
| 80 int browser_index = model->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); | 80 int browser_index = model->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT); |
| 81 DCHECK_GE(browser_index, 0); | 81 DCHECK_GE(browser_index, 0); |
| 82 ash::ShelfItem browser_item = model->items()[browser_index]; | 82 ash::ShelfItem browser_item = model->items()[browser_index]; |
| 83 ash::ShelfItemStatus browser_status = ash::STATUS_CLOSED; | 83 ash::ShelfItemStatus browser_status = ash::STATUS_CLOSED; |
| 84 | 84 |
| 85 aura::Window* window = ash::wm::GetActiveWindow(); | 85 aura::Window* window = ash::wm::GetActiveWindow(); |
| 86 if (window) { | 86 if (window) { |
| 87 // Check if the active browser / tab is a browser which is not an app, | 87 // Check if the active browser / tab is a browser which is not an app, |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 !browser->window()->IsMinimized()) { | 365 !browser->window()->IsMinimized()) { |
| 366 continue; | 366 continue; |
| 367 } | 367 } |
| 368 if (!IsBrowserRepresentedInBrowserList(browser) && | 368 if (!IsBrowserRepresentedInBrowserList(browser) && |
| 369 !browser->is_type_tabbed()) | 369 !browser->is_type_tabbed()) |
| 370 continue; | 370 continue; |
| 371 active_browsers.push_back(browser); | 371 active_browsers.push_back(browser); |
| 372 } | 372 } |
| 373 return active_browsers; | 373 return active_browsers; |
| 374 } | 374 } |
| OLD | NEW |