| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 content::WebContents* contents = | 95 content::WebContents* contents = |
| 96 browser->tab_strip_model()->GetActiveWebContents(); | 96 browser->tab_strip_model()->GetActiveWebContents(); |
| 97 if (contents && | 97 if (contents && |
| 98 (launcher_controller()->GetShelfIDForWebContents(contents) != | 98 (launcher_controller()->GetShelfIDForWebContents(contents) != |
| 99 browser_item.id)) | 99 browser_item.id)) |
| 100 browser_status = ash::STATUS_RUNNING; | 100 browser_status = ash::STATUS_RUNNING; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 if (browser_status == ash::STATUS_CLOSED) { | 104 if (browser_status == ash::STATUS_CLOSED) { |
| 105 const BrowserList* browser_list = BrowserList::GetInstance(); | 105 for (auto* browser : *BrowserList::GetInstance()) { |
| 106 for (BrowserList::const_reverse_iterator it = | 106 if (IsBrowserRepresentedInBrowserList(browser)) { |
| 107 browser_list->begin_last_active(); | |
| 108 it != browser_list->end_last_active() && | |
| 109 browser_status == ash::STATUS_CLOSED; | |
| 110 ++it) { | |
| 111 if (IsBrowserRepresentedInBrowserList(*it)) | |
| 112 browser_status = ash::STATUS_RUNNING; | 107 browser_status = ash::STATUS_RUNNING; |
| 108 break; |
| 109 } |
| 113 } | 110 } |
| 114 } | 111 } |
| 115 | 112 |
| 116 if (browser_status != browser_item.status) { | 113 if (browser_status != browser_item.status) { |
| 117 browser_item.status = browser_status; | 114 browser_item.status = browser_status; |
| 118 model->Set(browser_index, browser_item); | 115 model->Set(browser_index, browser_item); |
| 119 } | 116 } |
| 120 } | 117 } |
| 121 | 118 |
| 122 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( | 119 void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents( |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 !browser->window()->IsMinimized()) { | 362 !browser->window()->IsMinimized()) { |
| 366 continue; | 363 continue; |
| 367 } | 364 } |
| 368 if (!IsBrowserRepresentedInBrowserList(browser) && | 365 if (!IsBrowserRepresentedInBrowserList(browser) && |
| 369 !browser->is_type_tabbed()) | 366 !browser->is_type_tabbed()) |
| 370 continue; | 367 continue; |
| 371 active_browsers.push_back(browser); | 368 active_browsers.push_back(browser); |
| 372 } | 369 } |
| 373 return active_browsers; | 370 return active_browsers; |
| 374 } | 371 } |
| OLD | NEW |