OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> |
(...skipping 10 matching lines...) Expand all Loading... |
21 typedef std::vector<Browser*> BrowserVector; | 21 typedef std::vector<Browser*> BrowserVector; |
22 typedef BrowserVector::iterator iterator; | 22 typedef BrowserVector::iterator iterator; |
23 typedef BrowserVector::const_iterator const_iterator; | 23 typedef BrowserVector::const_iterator const_iterator; |
24 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; | 24 typedef BrowserVector::const_reverse_iterator const_reverse_iterator; |
25 | 25 |
26 // 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 |
27 // browser windows while handling observer callbacks. | 27 // browser windows while handling observer callbacks. |
28 class Observer { | 28 class Observer { |
29 public: | 29 public: |
30 // Called immediately after a browser is added to the list | 30 // Called immediately after a browser is added to the list |
31 virtual void OnBrowserAdded(const Browser* browser) = 0; | 31 virtual void OnBrowserAdded(Browser* browser) = 0; |
32 | 32 |
33 // Called immediately after a browser is removed from the list | 33 // Called immediately after a browser is removed from the list |
34 virtual void OnBrowserRemoved(const Browser* browser) = 0; | 34 virtual void OnBrowserRemoved(Browser* browser) = 0; |
35 | 35 |
36 // Called immediately after a browser is set active (SetLastActive) | 36 // Called immediately after a browser is set active (SetLastActive) |
37 virtual void OnBrowserSetLastActive(const Browser* browser) {} | 37 virtual void OnBrowserSetLastActive(Browser* browser) {} |
38 | 38 |
39 protected: | 39 protected: |
40 virtual ~Observer() {} | 40 virtual ~Observer() {} |
41 }; | 41 }; |
42 | 42 |
43 // Adds and removes browsers from the global list. The browser object should | 43 // Adds and removes browsers from the global list. The browser object should |
44 // be valid BEFORE these calls (for the benefit of observers), so notify and | 44 // be valid BEFORE these calls (for the benefit of observers), so notify and |
45 // THEN delete the object. | 45 // THEN delete the object. |
46 static void AddBrowser(Browser* browser); | 46 static void AddBrowser(Browser* browser); |
47 static void RemoveBrowser(Browser* browser); | 47 static void RemoveBrowser(Browser* browser); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // iterator over the TabContentsWrappers doing background printing. | 158 // iterator over the TabContentsWrappers doing background printing. |
159 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; | 159 std::set<TabContentsWrapper*>::const_iterator bg_printing_iterator_; |
160 | 160 |
161 // Current TabContentsWrapper, or NULL if we're at the end of the list. This | 161 // Current TabContentsWrapper, or NULL if we're at the end of the list. This |
162 // can be extracted given the browser iterator and index, but it's nice to | 162 // can be extracted given the browser iterator and index, but it's nice to |
163 // cache this since the caller may access the current host many times. | 163 // cache this since the caller may access the current host many times. |
164 TabContentsWrapper* cur_; | 164 TabContentsWrapper* cur_; |
165 }; | 165 }; |
166 | 166 |
167 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ | 167 #endif // CHROME_BROWSER_UI_BROWSER_LIST_H_ |
OLD | NEW |