| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_list.h" | 5 #include "chrome/browser/ui/browser_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Perform a stable partition on the browsers in the list so that the browsers | 198 // Perform a stable partition on the browsers in the list so that the browsers |
| 199 // in the new workspace appear after the browsers in the other workspaces. | 199 // in the new workspace appear after the browsers in the other workspaces. |
| 200 // | 200 // |
| 201 // For example, if we have a list of browser-workspace pairs | 201 // For example, if we have a list of browser-workspace pairs |
| 202 // [{b1, 0}, {b2, 1}, {b3, 0}, {b4, 1}] | 202 // [{b1, 0}, {b2, 1}, {b3, 0}, {b4, 1}] |
| 203 // and we switch to workspace 1, we want the resulting browser list to look | 203 // and we switch to workspace 1, we want the resulting browser list to look |
| 204 // like [{b1, 0}, {b3, 0}, {b2, 1}, {b4, 1}]. | 204 // like [{b1, 0}, {b3, 0}, {b2, 1}, {b4, 1}]. |
| 205 std::stable_partition( | 205 std::stable_partition( |
| 206 last_active_browsers.begin(), last_active_browsers.end(), | 206 last_active_browsers.begin(), last_active_browsers.end(), |
| 207 [&new_workspace](Browser* browser) { | 207 [&new_workspace](Browser* browser) { |
| 208 return browser->window()->GetWorkspace() != new_workspace; | 208 return !browser->window()->IsVisibleOnAllWorkspaces() && |
| 209 browser->window()->GetWorkspace() != new_workspace; |
| 209 }); | 210 }); |
| 210 | 211 |
| 211 Browser* new_last_active = instance->GetLastActive(); | 212 Browser* new_last_active = instance->GetLastActive(); |
| 212 if (old_last_active != new_last_active) { | 213 if (old_last_active != new_last_active) { |
| 213 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), | 214 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), |
| 214 OnBrowserSetLastActive(new_last_active)); | 215 OnBrowserSetLastActive(new_last_active)); |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 | 218 |
| 218 // static | 219 // static |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 257 } |
| 257 | 258 |
| 258 // static | 259 // static |
| 259 void BrowserList::RemoveBrowserFrom(Browser* browser, | 260 void BrowserList::RemoveBrowserFrom(Browser* browser, |
| 260 BrowserVector* browser_list) { | 261 BrowserVector* browser_list) { |
| 261 BrowserVector::iterator remove_browser = | 262 BrowserVector::iterator remove_browser = |
| 262 std::find(browser_list->begin(), browser_list->end(), browser); | 263 std::find(browser_list->begin(), browser_list->end(), browser); |
| 263 if (remove_browser != browser_list->end()) | 264 if (remove_browser != browser_list->end()) |
| 264 browser_list->erase(remove_browser); | 265 browser_list->erase(remove_browser); |
| 265 } | 266 } |
| OLD | NEW |