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

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

Issue 27369004: Change GetBrowserItemIndex() to GetLauncherItemIndexForType() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 months 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 (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/launcher/launcher.h" 9 #include "ash/launcher/launcher.h"
10 #include "ash/launcher/launcher_model.h" 10 #include "ash/launcher/launcher_model.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 void BrowserShortcutLauncherItemController::UpdateBrowserItemState() { 54 void BrowserShortcutLauncherItemController::UpdateBrowserItemState() {
55 // The shell will not be available for win7_aura unittests like 55 // The shell will not be available for win7_aura unittests like
56 // ChromeLauncherControllerTest.BrowserMenuGeneration. 56 // ChromeLauncherControllerTest.BrowserMenuGeneration.
57 if (!ash::Shell::HasInstance()) 57 if (!ash::Shell::HasInstance())
58 return; 58 return;
59 59
60 ash::LauncherModel* model = launcher_controller()->model(); 60 ash::LauncherModel* model = launcher_controller()->model();
61 61
62 // Determine the new browser's active state and change if necessary. 62 // Determine the new browser's active state and change if necessary.
63 size_t browser_index = ash::GetBrowserItemIndex(*model); 63 size_t browser_index =
64 ash::GetLauncherItemIndexForType(ash::TYPE_BROWSER_SHORTCUT, *model);
64 DCHECK_GE(browser_index, 0u); 65 DCHECK_GE(browser_index, 0u);
65 ash::LauncherItem browser_item = model->items()[browser_index]; 66 ash::LauncherItem browser_item = model->items()[browser_index];
66 ash::LauncherItemStatus browser_status = ash::STATUS_CLOSED; 67 ash::LauncherItemStatus browser_status = ash::STATUS_CLOSED;
67 68
68 aura::Window* window = ash::wm::GetActiveWindow(); 69 aura::Window* window = ash::wm::GetActiveWindow();
69 if (window) { 70 if (window) {
70 // Check if the active browser / tab is a browser which is not an app, 71 // Check if the active browser / tab is a browser which is not an app,
71 // a windowed app, a popup or any other item which is not a browser of 72 // a windowed app, a popup or any other item which is not a browser of
72 // interest. 73 // interest.
73 Browser* browser = chrome::FindBrowserWithWindow(window); 74 Browser* browser = chrome::FindBrowserWithWindow(window);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 Browser* browser) { 331 Browser* browser) {
331 return (browser && 332 return (browser &&
332 browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && 333 browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH &&
333 (browser->is_type_tabbed() || 334 (browser->is_type_tabbed() ||
334 !browser->is_app() || 335 !browser->is_app() ||
335 !browser->is_type_popup() || 336 !browser->is_type_popup() ||
336 launcher_controller()-> 337 launcher_controller()->
337 GetLauncherIDForAppID(web_app::GetExtensionIdFromApplicationName( 338 GetLauncherIDForAppID(web_app::GetExtensionIdFromApplicationName(
338 browser->app_name())) <= 0)); 339 browser->app_name())) <= 0));
339 } 340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698