OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_BROWSER_LIST_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_LIST_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_LIST_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_LIST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 | 15 |
16 class TabContents; | |
17 | |
18 // Stores a list of all Browser objects. | 16 // Stores a list of all Browser objects. |
19 class BrowserList { | 17 class BrowserList { |
20 public: | 18 public: |
21 typedef std::vector<Browser*> BrowserVector; | 19 typedef std::vector<Browser*> BrowserVector; |
22 typedef BrowserVector::iterator iterator; | 20 typedef BrowserVector::iterator iterator; |
23 typedef BrowserVector::const_iterator const_iterator; | 21 typedef BrowserVector::const_iterator const_iterator; |
24 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; | 22 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; |
25 | 23 |
26 // It is not allowed to change the global window list (add or remove any | 24 // It is not allowed to change the global window list (add or remove any |
27 // browser windows while handling observer callbacks. | 25 // browser windows while handling observer callbacks. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // returned. Returns NULL if no such browser currently exists. | 91 // returned. Returns NULL if no such browser currently exists. |
94 static Browser* FindBrowserWithProfile(Profile* profile); | 92 static Browser* FindBrowserWithProfile(Profile* profile); |
95 | 93 |
96 // Find an existing browser with the provided ID. Returns NULL if no such | 94 // Find an existing browser with the provided ID. Returns NULL if no such |
97 // browser currently exists. | 95 // browser currently exists. |
98 static Browser* FindBrowserWithID(SessionID::id_type desired_id); | 96 static Browser* FindBrowserWithID(SessionID::id_type desired_id); |
99 | 97 |
100 // Find the browser represented by |window| or NULL if not found. | 98 // Find the browser represented by |window| or NULL if not found. |
101 static Browser* FindBrowserWithWindow(gfx::NativeWindow window); | 99 static Browser* FindBrowserWithWindow(gfx::NativeWindow window); |
102 | 100 |
103 // Find the browser containing |tab_contents| or NULL if none is found. | 101 // Find the browser containing |web_contents| or NULL if none is found. |
104 // |tab_contents| must not be NULL. | 102 // |web_contents| must not be NULL. |
105 static Browser* FindBrowserWithTabContents(TabContents* tab_contents); | 103 static Browser* FindBrowserWithWebContents( |
| 104 content::WebContents* web_contents); |
106 | 105 |
107 // Checks if the browser can be automatically restarted to install upgrades | 106 // Checks if the browser can be automatically restarted to install upgrades |
108 // The browser can be automatically restarted when: | 107 // The browser can be automatically restarted when: |
109 // 1. It's in the background mode (no visible windows). | 108 // 1. It's in the background mode (no visible windows). |
110 // 2. An update exe is present in the install folder. | 109 // 2. An update exe is present in the install folder. |
111 static bool CanRestartForUpdate(); | 110 static bool CanRestartForUpdate(); |
112 | 111 |
113 // Starts a user initiated exit process. Called from Browser::Exit. | 112 // Starts a user initiated exit process. Called from Browser::Exit. |
114 // On platforms other than ChromeOS, this is equivalent to | 113 // On platforms other than ChromeOS, this is equivalent to |
115 // CloseAllBrowsersAndExit. On ChromeOS, this tells session manager | 114 // CloseAllBrowsersAndExit. On ChromeOS, this tells session manager |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // iterator over the TabContentsWrappers doing background printing. | 281 // iterator over the TabContentsWrappers doing background printing. |
283 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; | 282 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; |
284 | 283 |
285 // Current TabContents, or NULL if we're at the end of the list. This can | 284 // Current TabContents, or NULL if we're at the end of the list. This can |
286 // be extracted given the browser iterator and index, but it's nice to cache | 285 // be extracted given the browser iterator and index, but it's nice to cache |
287 // this since the caller may access the current host many times. | 286 // this since the caller may access the current host many times. |
288 TabContentsWrapper* cur_; | 287 TabContentsWrapper* cur_; |
289 }; | 288 }; |
290 | 289 |
291 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 290 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
OLD | NEW |