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 25 matching lines...) Expand all Loading... |
36 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
37 // BrowserList, public: | 37 // BrowserList, public: |
38 | 38 |
39 Browser* BrowserList::GetLastActive() const { | 39 Browser* BrowserList::GetLastActive() const { |
40 if (!last_active_browsers_.empty()) | 40 if (!last_active_browsers_.empty()) |
41 return *(last_active_browsers_.rbegin()); | 41 return *(last_active_browsers_.rbegin()); |
42 return NULL; | 42 return NULL; |
43 } | 43 } |
44 | 44 |
45 // static | 45 // static |
46 BrowserList* BrowserList::GetInstance(chrome::HostDesktopType type) { | 46 BrowserList* BrowserList::GetInstance(ui::HostDesktopType type) { |
47 BrowserList** list = NULL; | 47 BrowserList** list = NULL; |
48 if (type == chrome::HOST_DESKTOP_TYPE_NATIVE) | 48 if (type == ui::HOST_DESKTOP_TYPE_NATIVE) |
49 list = &native_instance_; | 49 list = &native_instance_; |
50 else if (type == chrome::HOST_DESKTOP_TYPE_ASH) | 50 else if (type == ui::HOST_DESKTOP_TYPE_ASH) |
51 list = &ash_instance_; | 51 list = &ash_instance_; |
52 else | 52 else |
53 NOTREACHED(); | 53 NOTREACHED(); |
54 if (!*list) | 54 if (!*list) |
55 *list = new BrowserList; | 55 *list = new BrowserList; |
56 return *list; | 56 return *list; |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 void BrowserList::AddBrowser(Browser* browser) { | 60 void BrowserList::AddBrowser(Browser* browser) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 | 235 |
236 // static | 236 // static |
237 void BrowserList::RemoveBrowserFrom(Browser* browser, | 237 void BrowserList::RemoveBrowserFrom(Browser* browser, |
238 BrowserVector* browser_list) { | 238 BrowserVector* browser_list) { |
239 BrowserVector::iterator remove_browser = | 239 BrowserVector::iterator remove_browser = |
240 std::find(browser_list->begin(), browser_list->end(), browser); | 240 std::find(browser_list->begin(), browser_list->end(), browser); |
241 if (remove_browser != browser_list->end()) | 241 if (remove_browser != browser_list->end()) |
242 browser_list->erase(remove_browser); | 242 browser_list->erase(remove_browser); |
243 } | 243 } |
OLD | NEW |