| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 static Browser* GetLastActive(); | 51 static Browser* GetLastActive(); |
| 52 | 52 |
| 53 // Identical in behavior to GetLastActive(), except that the most recently |
| 54 // open browser owned by |profile| is returned. If none exist, returns NULL. |
| 55 static Browser* GetLastActiveWithProfile(Profile *profile); |
| 56 |
| 53 // Find an existing browser window with the provided type. If the last active | 57 // Find an existing browser window with the provided type. If the last active |
| 54 // has the right type, it is returned. Otherwise, the next available browser | 58 // has the right type, it is returned. Otherwise, the next available browser |
| 55 // is returned. Returns NULL if no such browser currently exists. | 59 // is returned. Returns NULL if no such browser currently exists. |
| 56 static Browser* FindBrowserWithType(Profile* p, Browser::Type t); | 60 static Browser* FindBrowserWithType(Profile* p, Browser::Type t); |
| 57 | 61 |
| 58 // Find an existing browser with the provided ID. Returns NULL if no such | 62 // Find an existing browser with the provided ID. Returns NULL if no such |
| 59 // browser currently exists. | 63 // browser currently exists. |
| 60 static Browser* FindBrowserWithID(SessionID::id_type desired_id); | 64 static Browser* FindBrowserWithID(SessionID::id_type desired_id); |
| 61 | 65 |
| 62 // Closes all browsers. If use_post is true the windows are closed by way of | 66 // Closes all browsers. If use_post is true the windows are closed by way of |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // tab index into the current Browser of the current web view | 173 // tab index into the current Browser of the current web view |
| 170 int web_view_index_; | 174 int web_view_index_; |
| 171 | 175 |
| 172 // Current WebContents, or NULL if we're at the end of the list. This can | 176 // Current WebContents, or NULL if we're at the end of the list. This can |
| 173 // be extracted given the browser iterator and index, but it's nice to cache | 177 // be extracted given the browser iterator and index, but it's nice to cache |
| 174 // this since the caller may access the current host many times. | 178 // this since the caller may access the current host many times. |
| 175 WebContents* cur_; | 179 WebContents* cur_; |
| 176 }; | 180 }; |
| 177 | 181 |
| 178 #endif // CHROME_BROWSER_BROWSER_LIST_H__ | 182 #endif // CHROME_BROWSER_BROWSER_LIST_H__ |
| OLD | NEW |