OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 static void RemoveObserver(Observer* observer); | 46 static void RemoveObserver(Observer* observer); |
47 | 47 |
48 // Called by Browser objects when their window is activated (focused). This | 48 // Called by Browser objects when their window is activated (focused). This |
49 // allows us to determine what the last active Browser was. | 49 // allows us to determine what the last active Browser was. |
50 static void SetLastActive(Browser* browser); | 50 static void SetLastActive(Browser* browser); |
51 | 51 |
52 // Returns the Browser object whose window was most recently active. If the | 52 // Returns the Browser object whose window was most recently active. If the |
53 // most recently open Browser's window was closed, returns the first Browser | 53 // most recently open Browser's window was closed, returns the first Browser |
54 // in the list. If no Browsers exist, returns NULL. | 54 // in the list. If no Browsers exist, returns NULL. |
55 // | 55 // |
56 // WARNING: this is NULL until a browser becomes active. If during startup | 56 // WARNING: This is NULL until a browser becomes active. That should happen |
57 // a browser does not become active (perhaps the user launches Chrome, then | 57 // during launch; see comment in BrowserInit::LaunchWithProfile::Launch(). |
58 // clicks on another app before the first browser window appears) then this | |
59 // returns NULL. | |
60 // WARNING #2: this will always be NULL in unit tests run on the bots. | |
61 static Browser* GetLastActive(); | 58 static Browser* GetLastActive(); |
62 | 59 |
63 // Identical in behavior to GetLastActive(), except that the most recently | 60 // Identical in behavior to GetLastActive(), except that the most recently |
64 // open browser owned by |profile| is returned. If none exist, returns NULL. | 61 // open browser owned by |profile| is returned. If none exist, returns NULL. |
65 // WARNING: see warnings in GetLastActive(). | 62 // WARNING: see warnings in GetLastActive(). |
66 static Browser* GetLastActiveWithProfile(Profile *profile); | 63 static Browser* GetLastActiveWithProfile(Profile *profile); |
67 | 64 |
68 // Find an existing browser window with the provided type. Searches in the | 65 // Find an existing browser window with the provided type. Searches in the |
69 // order of last activation. Only browsers that have been active can be | 66 // order of last activation. Only browsers that have been active can be |
70 // returned. If |match_incognito| is true, will match a browser with either | 67 // returned. If |match_incognito| is true, will match a browser with either |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // tab index into the current Browser of the current web view | 223 // tab index into the current Browser of the current web view |
227 int web_view_index_; | 224 int web_view_index_; |
228 | 225 |
229 // Current TabContents, or NULL if we're at the end of the list. This can | 226 // Current TabContents, or NULL if we're at the end of the list. This can |
230 // be extracted given the browser iterator and index, but it's nice to cache | 227 // be extracted given the browser iterator and index, but it's nice to cache |
231 // this since the caller may access the current host many times. | 228 // this since the caller may access the current host many times. |
232 TabContents* cur_; | 229 TabContents* cur_; |
233 }; | 230 }; |
234 | 231 |
235 #endif // CHROME_BROWSER_BROWSER_LIST_H_ | 232 #endif // CHROME_BROWSER_BROWSER_LIST_H_ |
OLD | NEW |