| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 bool BrowserList::IsOffTheRecordSessionActive() { | 208 bool BrowserList::IsOffTheRecordSessionActive() { |
| 209 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 209 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 210 if (it->profile()->IsOffTheRecord()) | 210 if (it->profile()->IsOffTheRecord()) |
| 211 return true; | 211 return true; |
| 212 } | 212 } |
| 213 return false; | 213 return false; |
| 214 } | 214 } |
| 215 | 215 |
| 216 // static | 216 // static |
| 217 bool BrowserList::IsOffTheRecordSessionActiveForProfile(Profile* profile) { | 217 bool BrowserList::IsOffTheRecordSessionActiveForProfile(Profile* profile) { |
| 218 if (profile->IsGuestSession()) | |
| 219 return true; | |
| 220 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 218 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 221 if (it->profile()->IsSameProfile(profile) && | 219 if (it->profile()->IsSameProfile(profile) && |
| 222 it->profile()->IsOffTheRecord()) { | 220 it->profile()->IsOffTheRecord()) { |
| 223 return true; | 221 return true; |
| 224 } | 222 } |
| 225 } | 223 } |
| 226 return false; | 224 return false; |
| 227 } | 225 } |
| 228 | 226 |
| 229 //////////////////////////////////////////////////////////////////////////////// | 227 //////////////////////////////////////////////////////////////////////////////// |
| 230 // BrowserList, private: | 228 // BrowserList, private: |
| 231 | 229 |
| 232 BrowserList::BrowserList() { | 230 BrowserList::BrowserList() { |
| 233 } | 231 } |
| 234 | 232 |
| 235 BrowserList::~BrowserList() { | 233 BrowserList::~BrowserList() { |
| 236 } | 234 } |
| 237 | 235 |
| 238 // static | 236 // static |
| 239 void BrowserList::RemoveBrowserFrom(Browser* browser, | 237 void BrowserList::RemoveBrowserFrom(Browser* browser, |
| 240 BrowserVector* browser_list) { | 238 BrowserVector* browser_list) { |
| 241 BrowserVector::iterator remove_browser = | 239 BrowserVector::iterator remove_browser = |
| 242 std::find(browser_list->begin(), browser_list->end(), browser); | 240 std::find(browser_list->begin(), browser_list->end(), browser); |
| 243 if (remove_browser != browser_list->end()) | 241 if (remove_browser != browser_list->end()) |
| 244 browser_list->erase(remove_browser); | 242 browser_list->erase(remove_browser); |
| 245 } | 243 } |
| OLD | NEW |