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

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

Issue 1661713002: Remove the rest of HostDesktopType from c/b/ui/browser_finder.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-11
Patch Set: linux adl Created 4 years, 10 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/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/shelf/shelf_model.h" 10 #include "ash/shelf/shelf_model.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const BrowserList* browser_list = BrowserList::GetInstance(); 139 const BrowserList* browser_list = BrowserList::GetInstance();
140 for (BrowserList::const_iterator it = browser_list->begin(); 140 for (BrowserList::const_iterator it = browser_list->begin();
141 it != browser_list->end(); ++it) { 141 it != browser_list->end(); ++it) {
142 if (launcher_controller()->IsBrowserFromActiveUser(*it)) 142 if (launcher_controller()->IsBrowserFromActiveUser(*it))
143 return true; 143 return true;
144 } 144 }
145 return false; 145 return false;
146 } 146 }
147 147
148 bool BrowserShortcutLauncherItemController::IsVisible() const { 148 bool BrowserShortcutLauncherItemController::IsVisible() const {
149 Browser* last_browser = chrome::FindTabbedBrowser( 149 Browser* last_browser =
150 launcher_controller()->profile(), 150 chrome::FindTabbedBrowser(launcher_controller()->profile(), true);
151 true,
152 chrome::HOST_DESKTOP_TYPE_ASH);
153 151
154 if (!last_browser) { 152 if (!last_browser) {
155 return false; 153 return false;
156 } 154 }
157 155
158 aura::Window* window = last_browser->window()->GetNativeWindow(); 156 aura::Window* window = last_browser->window()->GetNativeWindow();
159 return ash::wm::IsActiveWindow(window); 157 return ash::wm::IsActiveWindow(window);
160 } 158 }
161 159
162 void BrowserShortcutLauncherItemController::Launch(ash::LaunchSource source, 160 void BrowserShortcutLauncherItemController::Launch(ash::LaunchSource source,
163 int event_flags) { 161 int event_flags) {
164 } 162 }
165 163
166 ash::ShelfItemDelegate::PerformedAction 164 ash::ShelfItemDelegate::PerformedAction
167 BrowserShortcutLauncherItemController::Activate(ash::LaunchSource source) { 165 BrowserShortcutLauncherItemController::Activate(ash::LaunchSource source) {
168 Browser* last_browser = chrome::FindTabbedBrowser( 166 Browser* last_browser =
169 launcher_controller()->profile(), 167 chrome::FindTabbedBrowser(launcher_controller()->profile(), true);
170 true,
171 chrome::HOST_DESKTOP_TYPE_ASH);
172 168
173 if (!last_browser) { 169 if (!last_browser) {
174 launcher_controller()->CreateNewWindow(); 170 launcher_controller()->CreateNewWindow();
175 return kNewWindowCreated; 171 return kNewWindowCreated;
176 } 172 }
177 173
178 return launcher_controller()->ActivateWindowOrMinimizeIfActive( 174 return launcher_controller()->ActivateWindowOrMinimizeIfActive(
179 last_browser->window(), GetApplicationList(0).size() == 2); 175 last_browser->window(), GetApplicationList(0).size() == 2);
180 } 176 }
181 177
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 browser = items[0]; 330 browser = items[0];
335 } else { 331 } else {
336 // If there is more then one suitable browser, we advance to the next if 332 // If there is more then one suitable browser, we advance to the next if
337 // |browser| is already active - or - check the last used browser if it can 333 // |browser| is already active - or - check the last used browser if it can
338 // be used. 334 // be used.
339 std::vector<Browser*>::iterator i = 335 std::vector<Browser*>::iterator i =
340 std::find(items.begin(), items.end(), browser); 336 std::find(items.begin(), items.end(), browser);
341 if (i != items.end()) { 337 if (i != items.end()) {
342 browser = (++i == items.end()) ? items[0] : *i; 338 browser = (++i == items.end()) ? items[0] : *i;
343 } else { 339 } else {
344 browser = chrome::FindTabbedBrowser(launcher_controller()->profile(), 340 browser =
345 true, 341 chrome::FindTabbedBrowser(launcher_controller()->profile(), true);
346 chrome::HOST_DESKTOP_TYPE_ASH);
347 if (!browser || 342 if (!browser ||
348 !IsBrowserRepresentedInBrowserList(browser)) 343 !IsBrowserRepresentedInBrowserList(browser))
349 browser = items[0]; 344 browser = items[0];
350 } 345 }
351 } 346 }
352 DCHECK(browser); 347 DCHECK(browser);
353 browser->window()->Show(); 348 browser->window()->Show();
354 browser->window()->Activate(); 349 browser->window()->Activate();
355 return kExistingWindowActivated; 350 return kExistingWindowActivated;
356 } 351 }
(...skipping 13 matching lines...) Expand all
370 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0) 365 web_app::GetExtensionIdFromApplicationName(browser->app_name())) > 0)
371 return false; 366 return false;
372 367
373 // Settings browsers have their own icon. 368 // Settings browsers have their own icon.
374 if (IsSettingsBrowser(browser)) 369 if (IsSettingsBrowser(browser))
375 return false; 370 return false;
376 371
377 // Tabbed browser and other popup windows are all represented. 372 // Tabbed browser and other popup windows are all represented.
378 return true; 373 return true;
379 } 374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698