| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (*i == last_active) | 216 if (*i == last_active) |
| 217 continue; | 217 continue; |
| 218 | 218 |
| 219 if ((*i)->profile() == p && (*i)->type() == t) | 219 if ((*i)->profile() == p && (*i)->type() == t) |
| 220 return *i; | 220 return *i; |
| 221 } | 221 } |
| 222 return NULL; | 222 return NULL; |
| 223 } | 223 } |
| 224 | 224 |
| 225 // static | 225 // static |
| 226 Browser* BrowserList::FindBrowserWithProfile(Profile* p) { |
| 227 Browser* last_active = GetLastActive(); |
| 228 if (last_active && last_active->profile() == p) |
| 229 return last_active; |
| 230 |
| 231 BrowserList::const_iterator i; |
| 232 for (i = BrowserList::begin(); i != BrowserList::end(); ++i) { |
| 233 if (*i == last_active) |
| 234 continue; |
| 235 |
| 236 if ((*i)->profile() == p) |
| 237 return *i; |
| 238 } |
| 239 return NULL; |
| 240 } |
| 241 |
| 242 // static |
| 226 Browser* BrowserList::FindBrowserWithID(SessionID::id_type desired_id) { | 243 Browser* BrowserList::FindBrowserWithID(SessionID::id_type desired_id) { |
| 227 BrowserList::const_iterator i; | 244 BrowserList::const_iterator i; |
| 228 for (i = BrowserList::begin(); i != BrowserList::end(); ++i) { | 245 for (i = BrowserList::begin(); i != BrowserList::end(); ++i) { |
| 229 if ((*i)->session_id().id() == desired_id) | 246 if ((*i)->session_id().id() == desired_id) |
| 230 return *i; | 247 return *i; |
| 231 } | 248 } |
| 232 return NULL; | 249 return NULL; |
| 233 } | 250 } |
| 234 | 251 |
| 235 // static | 252 // static |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 317 } |
| 301 | 318 |
| 302 WebContents* next_tab = | 319 WebContents* next_tab = |
| 303 (*browser_iterator_)->GetTabContentsAt(web_view_index_)->AsWebContents(); | 320 (*browser_iterator_)->GetTabContentsAt(web_view_index_)->AsWebContents(); |
| 304 if (next_tab) { | 321 if (next_tab) { |
| 305 cur_ = next_tab; | 322 cur_ = next_tab; |
| 306 return; | 323 return; |
| 307 } | 324 } |
| 308 } | 325 } |
| 309 } | 326 } |
| OLD | NEW |