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/common/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
10 #include "ash/shelf/shelf_delegate.h" | 10 #include "ash/shelf/shelf_delegate.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (items.size() == 1) { | 303 if (items.size() == 1) { |
304 // If there is only one suitable browser, we can either activate it, or | 304 // If there is only one suitable browser, we can either activate it, or |
305 // bounce it (if it is already active). | 305 // bounce it (if it is already active). |
306 if (browser == items[0]) { | 306 if (browser == items[0]) { |
307 AnimateWindow(browser->window()->GetNativeWindow(), | 307 AnimateWindow(browser->window()->GetNativeWindow(), |
308 wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 308 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
309 return kNoAction; | 309 return kNoAction; |
310 } | 310 } |
311 browser = items[0]; | 311 browser = items[0]; |
312 } else { | 312 } else { |
313 // If there is more then one suitable browser, we advance to the next if | 313 // If there is more than one suitable browser, we advance to the next if |
314 // |browser| is already active - or - check the last used browser if it can | 314 // |browser| is already active - or - check the last used browser if it can |
315 // be used. | 315 // be used. |
316 std::vector<Browser*>::iterator i = | 316 std::vector<Browser*>::iterator i = |
317 std::find(items.begin(), items.end(), browser); | 317 std::find(items.begin(), items.end(), browser); |
318 if (i != items.end()) { | 318 if (i != items.end()) { |
319 browser = (++i == items.end()) ? items[0] : *i; | 319 browser = (++i == items.end()) ? items[0] : *i; |
320 } else { | 320 } else { |
321 browser = | 321 browser = |
322 chrome::FindTabbedBrowser(launcher_controller()->GetProfile(), true); | 322 chrome::FindTabbedBrowser(launcher_controller()->GetProfile(), true); |
323 if (!browser || | 323 if (!browser || |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 !browser->window()->IsMinimized()) { | 364 !browser->window()->IsMinimized()) { |
365 continue; | 365 continue; |
366 } | 366 } |
367 if (!IsBrowserRepresentedInBrowserList(browser) && | 367 if (!IsBrowserRepresentedInBrowserList(browser) && |
368 !browser->is_type_tabbed()) | 368 !browser->is_type_tabbed()) |
369 continue; | 369 continue; |
370 active_browsers.push_back(browser); | 370 active_browsers.push_back(browser); |
371 } | 371 } |
372 return active_browsers; | 372 return active_browsers; |
373 } | 373 } |
OLD | NEW |