| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 content::RecordAction(UserMetricsAction("ActiveBrowserChanged")); | 190 content::RecordAction(UserMetricsAction("ActiveBrowserChanged")); |
| 191 | 191 |
| 192 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_); | 192 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_); |
| 193 GetInstance()->last_active_browsers_.push_back(browser); | 193 GetInstance()->last_active_browsers_.push_back(browser); |
| 194 | 194 |
| 195 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), | 195 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), |
| 196 OnBrowserSetLastActive(browser)); | 196 OnBrowserSetLastActive(browser)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 // static | 199 // static |
| 200 void BrowserList::NotifyBrowserNoLongerActive(Browser* browser) { |
| 201 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), |
| 202 OnBrowserNoLongerActive(browser)); |
| 203 } |
| 204 |
| 205 // static |
| 200 bool BrowserList::IsIncognitoSessionActive() { | 206 bool BrowserList::IsIncognitoSessionActive() { |
| 201 for (auto* browser : *BrowserList::GetInstance()) { | 207 for (auto* browser : *BrowserList::GetInstance()) { |
| 202 if (browser->profile()->IsOffTheRecord()) | 208 if (browser->profile()->IsOffTheRecord()) |
| 203 return true; | 209 return true; |
| 204 } | 210 } |
| 205 return false; | 211 return false; |
| 206 } | 212 } |
| 207 | 213 |
| 208 // static | 214 // static |
| 209 bool BrowserList::IsIncognitoSessionActiveForProfile(Profile* profile) { | 215 bool BrowserList::IsIncognitoSessionActiveForProfile(Profile* profile) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 226 } | 232 } |
| 227 | 233 |
| 228 // static | 234 // static |
| 229 void BrowserList::RemoveBrowserFrom(Browser* browser, | 235 void BrowserList::RemoveBrowserFrom(Browser* browser, |
| 230 BrowserVector* browser_list) { | 236 BrowserVector* browser_list) { |
| 231 BrowserVector::iterator remove_browser = | 237 BrowserVector::iterator remove_browser = |
| 232 std::find(browser_list->begin(), browser_list->end(), browser); | 238 std::find(browser_list->begin(), browser_list->end(), browser); |
| 233 if (remove_browser != browser_list->end()) | 239 if (remove_browser != browser_list->end()) |
| 234 browser_list->erase(remove_browser); | 240 browser_list->erase(remove_browser); |
| 235 } | 241 } |
| OLD | NEW |