Chromium Code Reviews| 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 | |
| 16 // Stores a list of all Browser objects. | 18 // Stores a list of all Browser objects. |
| 17 class BrowserList { | 19 class BrowserList { |
| 18 public: | 20 public: |
| 19 typedef std::vector<Browser*> BrowserVector; | 21 typedef std::vector<Browser*> BrowserVector; |
| 20 typedef BrowserVector::iterator iterator; | 22 typedef BrowserVector::iterator iterator; |
| 21 typedef BrowserVector::const_iterator const_iterator; | 23 typedef BrowserVector::const_iterator const_iterator; |
| 22 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; | 24 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; |
| 23 | 25 |
| 24 // It is not allowed to change the global window list (add or remove any | 26 // It is not allowed to change the global window list (add or remove any |
| 25 // browser windows while handling observer callbacks. | 27 // browser windows while handling observer callbacks. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // returned. Returns NULL if no such browser currently exists. | 93 // returned. Returns NULL if no such browser currently exists. |
| 92 static Browser* FindBrowserWithProfile(Profile* profile); | 94 static Browser* FindBrowserWithProfile(Profile* profile); |
| 93 | 95 |
| 94 // Find an existing browser with the provided ID. Returns NULL if no such | 96 // Find an existing browser with the provided ID. Returns NULL if no such |
| 95 // browser currently exists. | 97 // browser currently exists. |
| 96 static Browser* FindBrowserWithID(SessionID::id_type desired_id); | 98 static Browser* FindBrowserWithID(SessionID::id_type desired_id); |
| 97 | 99 |
| 98 // Find the browser represented by |window| or NULL if not found. | 100 // Find the browser represented by |window| or NULL if not found. |
| 99 static Browser* FindBrowserWithWindow(gfx::NativeWindow window); | 101 static Browser* FindBrowserWithWindow(gfx::NativeWindow window); |
| 100 | 102 |
| 103 // Find the browser containing |tab_contents| or NULL if none is found. | |
| 104 static Browser* FindBrowserWithTabContents(TabContents* tab_contents); | |
|
James Hawkins
2011/10/12 17:34:18
|tab_contents| must not be NULL.
sail
2011/10/12 17:54:12
Done.
| |
| 105 | |
| 101 // Checks if the browser can be automatically restarted to install upgrades | 106 // Checks if the browser can be automatically restarted to install upgrades |
| 102 // The browser can be automatically restarted when: | 107 // The browser can be automatically restarted when: |
| 103 // 1. It's in the background mode (no visible windows). | 108 // 1. It's in the background mode (no visible windows). |
| 104 // 2. An update exe is present in the install folder. | 109 // 2. An update exe is present in the install folder. |
| 105 static bool CanRestartForUpdate(); | 110 static bool CanRestartForUpdate(); |
| 106 | 111 |
| 107 // Starts a user initiated exit process. Called from Browser::Exit. | 112 // Starts a user initiated exit process. Called from Browser::Exit. |
| 108 // On platforms other than ChromeOS, this is equivalent to | 113 // On platforms other than ChromeOS, this is equivalent to |
| 109 // CloseAllBrowsersAndExit. On ChromeOS, this tells session manager | 114 // CloseAllBrowsersAndExit. On ChromeOS, this tells session manager |
| 110 // that chrome is signing out, which lets session manager send | 115 // that chrome is signing out, which lets session manager send |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 // iterator over the TabContentsWrappers doing background printing. | 290 // iterator over the TabContentsWrappers doing background printing. |
| 286 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; | 291 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; |
| 287 | 292 |
| 288 // Current TabContents, or NULL if we're at the end of the list. This can | 293 // Current TabContents, or NULL if we're at the end of the list. This can |
| 289 // be extracted given the browser iterator and index, but it's nice to cache | 294 // be extracted given the browser iterator and index, but it's nice to cache |
| 290 // this since the caller may access the current host many times. | 295 // this since the caller may access the current host many times. |
| 291 TabContentsWrapper* cur_; | 296 TabContentsWrapper* cur_; |
| 292 }; | 297 }; |
| 293 | 298 |
| 294 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 299 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
| OLD | NEW |