summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_list.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 18:17:29 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 18:17:29 +0000
commit121594b409d3d7459ae7a8068e2bae9b8b222d0f (patch)
treeba3c5479ba02191591a18722b13f2050a28e52eb /chrome/browser/browser_list.h
parentb49ec50466482cdc03d827d6fd53485a3efffd7b (diff)
downloadchromium_src-121594b409d3d7459ae7a8068e2bae9b8b222d0f.zip
chromium_src-121594b409d3d7459ae7a8068e2bae9b8b222d0f.tar.gz
chromium_src-121594b409d3d7459ae7a8068e2bae9b8b222d0f.tar.bz2
Clean up some Observer code. Original patch by Thiago Farina (see http://codereview.chromium.org/1725007 ), r=me.
BUG=none TEST=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_list.h')
-rw-r--r--chrome/browser/browser_list.h32
1 files changed, 13 insertions, 19 deletions
diff --git a/chrome/browser/browser_list.h b/chrome/browser/browser_list.h
index a5f40a9..8038baf 100644
--- a/chrome/browser/browser_list.h
+++ b/chrome/browser/browser_list.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,15 +7,16 @@
#include <vector>
+#include "base/observer_list.h"
#include "chrome/browser/browser.h"
// Stores a list of all Browser objects.
class BrowserList {
public:
- typedef std::vector<Browser*> list_type;
- typedef list_type::iterator iterator;
- typedef list_type::const_iterator const_iterator;
- typedef list_type::const_reverse_iterator const_reverse_iterator;
+ typedef std::vector<Browser*> BrowserVector;
+ typedef BrowserVector::iterator iterator;
+ typedef BrowserVector::const_iterator const_iterator;
+ typedef BrowserVector::const_reverse_iterator const_reverse_iterator;
// It is not allowed to change the global window list (add or remove any
// browser windows while handling observer callbacks.
@@ -107,17 +108,10 @@ class BrowserList {
// Returns true if browser is in persistent mode and false otherwise.
static bool IsInPersistentMode();
- static const_iterator begin() {
- return browsers_.begin();
- }
-
- static const_iterator end() {
- return browsers_.end();
- }
+ static const_iterator begin() { return browsers_.begin(); }
+ static const_iterator end() { return browsers_.end(); }
- static size_t size() {
- return browsers_.size();
- }
+ static size_t size() { return browsers_.size(); }
// Returns iterated access to list of open browsers ordered by when
// they were last active. The underlying data structure is a vector
@@ -147,11 +141,11 @@ class BrowserList {
private:
// Helper method to remove a browser instance from a list of browsers
- static void RemoveBrowserFrom(Browser* browser, list_type* browser_list);
+ static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list);
- static list_type browsers_;
- static std::vector<Observer*> observers_;
- static list_type last_active_browsers_;
+ static BrowserVector browsers_;
+ static BrowserVector last_active_browsers_;
+ static ObserverList<Observer> observers_;
};
class TabContents;