OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_BROWSER_LIST_H__ | 5 #ifndef CHROME_BROWSER_BROWSER_LIST_H__ |
6 #define CHROME_BROWSER_BROWSER_LIST_H__ | 6 #define CHROME_BROWSER_BROWSER_LIST_H__ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 static void SetLastActive(Browser* browser); | 45 static void SetLastActive(Browser* browser); |
46 | 46 |
47 // Returns the Browser object whose window was most recently active. If the | 47 // Returns the Browser object whose window was most recently active. If the |
48 // most recently open Browser's window was closed, returns the first Browser | 48 // most recently open Browser's window was closed, returns the first Browser |
49 // in the list. If no Browsers exist, returns NULL. | 49 // in the list. If no Browsers exist, returns NULL. |
50 // | 50 // |
51 // WARNING: this is NULL until a browser becomes active. If during startup | 51 // WARNING: this is NULL until a browser becomes active. If during startup |
52 // a browser does not become active (perhaps the user launches Chrome, then | 52 // a browser does not become active (perhaps the user launches Chrome, then |
53 // clicks on another app before the first browser window appears) then this | 53 // clicks on another app before the first browser window appears) then this |
54 // returns NULL. | 54 // returns NULL. |
| 55 // WARNING #2: this will always be NULL in unit tests run on the bots. |
55 static Browser* GetLastActive(); | 56 static Browser* GetLastActive(); |
56 | 57 |
57 // Identical in behavior to GetLastActive(), except that the most recently | 58 // Identical in behavior to GetLastActive(), except that the most recently |
58 // open browser owned by |profile| is returned. If none exist, returns NULL. | 59 // open browser owned by |profile| is returned. If none exist, returns NULL. |
| 60 // WARNING: see warnings in GetLastActive(). |
59 static Browser* GetLastActiveWithProfile(Profile *profile); | 61 static Browser* GetLastActiveWithProfile(Profile *profile); |
60 | 62 |
61 // Find an existing browser window with the provided type. Searches in the | 63 // Find an existing browser window with the provided type. Searches in the |
62 // order of last activation. Only browsers that have been active can be | 64 // order of last activation. Only browsers that have been active can be |
63 // returned. Returns NULL if no such browser currently exists. | 65 // returned. Returns NULL if no such browser currently exists. |
64 static Browser* FindBrowserWithType(Profile* p, Browser::Type t); | 66 static Browser* FindBrowserWithType(Profile* p, Browser::Type t); |
65 | 67 |
66 // Find an existing browser window with the provided profile. Searches in the | 68 // Find an existing browser window with the provided profile. Searches in the |
67 // order of last activation. Only browsers that have been active can be | 69 // order of last activation. Only browsers that have been active can be |
68 // returned. Returns NULL if no such browser currently exists. | 70 // returned. Returns NULL if no such browser currently exists. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // tab index into the current Browser of the current web view | 193 // tab index into the current Browser of the current web view |
192 int web_view_index_; | 194 int web_view_index_; |
193 | 195 |
194 // Current TabContents, or NULL if we're at the end of the list. This can | 196 // Current TabContents, or NULL if we're at the end of the list. This can |
195 // be extracted given the browser iterator and index, but it's nice to cache | 197 // be extracted given the browser iterator and index, but it's nice to cache |
196 // this since the caller may access the current host many times. | 198 // this since the caller may access the current host many times. |
197 TabContents* cur_; | 199 TabContents* cur_; |
198 }; | 200 }; |
199 | 201 |
200 #endif // CHROME_BROWSER_BROWSER_LIST_H__ | 202 #endif // CHROME_BROWSER_BROWSER_LIST_H__ |
OLD | NEW |