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 #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 <algorithm> | 8 #include <algorithm> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 static void AddObserver(Observer* observer); | 41 static void AddObserver(Observer* observer); |
42 static void RemoveObserver(Observer* observer); | 42 static void RemoveObserver(Observer* observer); |
43 | 43 |
44 // Called by Browser objects when their window is activated (focused). This | 44 // Called by Browser objects when their window is activated (focused). This |
45 // allows us to determine what the last active Browser was. | 45 // allows us to determine what the last active Browser was. |
46 static void SetLastActive(Browser* browser); | 46 static void SetLastActive(Browser* browser); |
47 | 47 |
48 // Returns the Browser object whose window was most recently active. If the | 48 // Returns the Browser object whose window was most recently active. If the |
49 // most recently open Browser's window was closed, returns the first Browser | 49 // most recently open Browser's window was closed, returns the first Browser |
50 // in the list. If no Browsers exist, returns NULL. | 50 // in the list. If no Browsers exist, returns NULL. |
| 51 // |
| 52 // WARNING: this is NULL until a browser becomes active. If during startup |
| 53 // a browser does not become active (perhaps the user launches Chrome, then |
| 54 // clicks on another app before the first browser window appears) then this |
| 55 // returns NULL. |
51 static Browser* GetLastActive(); | 56 static Browser* GetLastActive(); |
52 | 57 |
53 // Identical in behavior to GetLastActive(), except that the most recently | 58 // Identical in behavior to GetLastActive(), except that the most recently |
54 // 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. |
55 static Browser* GetLastActiveWithProfile(Profile *profile); | 60 static Browser* GetLastActiveWithProfile(Profile *profile); |
56 | 61 |
57 // Find an existing browser window with the provided type. If the last active | 62 // Find an existing browser window with the provided type. If the last active |
58 // has the right type, it is returned. Otherwise, the next available browser | 63 // has the right type, it is returned. Otherwise, the next available browser |
59 // is returned. Returns NULL if no such browser currently exists. | 64 // is returned. Returns NULL if no such browser currently exists. |
60 static Browser* FindBrowserWithType(Profile* p, Browser::Type t); | 65 static Browser* FindBrowserWithType(Profile* p, Browser::Type t); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // tab index into the current Browser of the current web view | 186 // tab index into the current Browser of the current web view |
182 int web_view_index_; | 187 int web_view_index_; |
183 | 188 |
184 // Current TabContents, or NULL if we're at the end of the list. This can | 189 // Current TabContents, or NULL if we're at the end of the list. This can |
185 // be extracted given the browser iterator and index, but it's nice to cache | 190 // be extracted given the browser iterator and index, but it's nice to cache |
186 // this since the caller may access the current host many times. | 191 // this since the caller may access the current host many times. |
187 TabContents* cur_; | 192 TabContents* cur_; |
188 }; | 193 }; |
189 | 194 |
190 #endif // CHROME_BROWSER_BROWSER_LIST_H__ | 195 #endif // CHROME_BROWSER_BROWSER_LIST_H__ |
OLD | NEW |