• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
7 #pragma once
8 
9 #include <vector>
10 #include "base/basictypes.h"
11 
12 class AutomationProvider;
13 
14 // Stores a list of all AutomationProvider objects.
15 class AutomationProviderList {
16  public:
17   ~AutomationProviderList();
18   typedef std::vector<AutomationProvider*> list_type;
19   typedef list_type::iterator iterator;
20   typedef list_type::const_iterator const_iterator;
21 
22   // Adds and removes automation providers from the global list.
23   bool AddProvider(AutomationProvider* provider);
24   bool RemoveProvider(AutomationProvider* provider);
25 
begin()26   const_iterator begin() {
27     return automation_providers_.begin();
28   }
29 
end()30   const_iterator end() {
31     return automation_providers_.end();
32   }
33 
size()34   size_t size() {
35     return automation_providers_.size();
36   }
37 
38   static AutomationProviderList* GetInstance();
39 
40  private:
41   AutomationProviderList();
42   void OnLastProviderRemoved();
43   list_type automation_providers_;
44   static AutomationProviderList* instance_;
45 
46   DISALLOW_COPY_AND_ASSIGN(AutomationProviderList);
47 };
48 
49 #endif  // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
50