| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 content::RecordAction(UserMetricsAction("ActiveBrowserChanged")); | 221 content::RecordAction(UserMetricsAction("ActiveBrowserChanged")); |
| 222 | 222 |
| 223 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_); | 223 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_); |
| 224 GetInstance()->last_active_browsers_.push_back(browser); | 224 GetInstance()->last_active_browsers_.push_back(browser); |
| 225 | 225 |
| 226 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), | 226 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), |
| 227 OnBrowserSetLastActive(browser)); | 227 OnBrowserSetLastActive(browser)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // static | 230 // static |
| 231 void BrowserList::NotifyBrowserNoLongerActive(Browser* browser) { |
| 232 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), |
| 233 OnBrowserNoLongerActive(browser)); |
| 234 } |
| 235 |
| 236 // static |
| 231 bool BrowserList::IsIncognitoSessionActive() { | 237 bool BrowserList::IsIncognitoSessionActive() { |
| 232 for (auto* browser : *BrowserList::GetInstance()) { | 238 for (auto* browser : *BrowserList::GetInstance()) { |
| 233 if (browser->profile()->IsOffTheRecord()) | 239 if (browser->profile()->IsOffTheRecord()) |
| 234 return true; | 240 return true; |
| 235 } | 241 } |
| 236 return false; | 242 return false; |
| 237 } | 243 } |
| 238 | 244 |
| 239 // static | 245 // static |
| 240 bool BrowserList::IsIncognitoSessionActiveForProfile(Profile* profile) { | 246 bool BrowserList::IsIncognitoSessionActiveForProfile(Profile* profile) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 257 } | 263 } |
| 258 | 264 |
| 259 // static | 265 // static |
| 260 void BrowserList::RemoveBrowserFrom(Browser* browser, | 266 void BrowserList::RemoveBrowserFrom(Browser* browser, |
| 261 BrowserVector* browser_list) { | 267 BrowserVector* browser_list) { |
| 262 BrowserVector::iterator remove_browser = | 268 BrowserVector::iterator remove_browser = |
| 263 std::find(browser_list->begin(), browser_list->end(), browser); | 269 std::find(browser_list->begin(), browser_list->end(), browser); |
| 264 if (remove_browser != browser_list->end()) | 270 if (remove_browser != browser_list->end()) |
| 265 browser_list->erase(remove_browser); | 271 browser_list->erase(remove_browser); |
| 266 } | 272 } |
| OLD | NEW |