summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_provider_list.h
blob: 47145faf5fc359a5871ffc4abdd654b3a42b9855 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2006-2008 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.

#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
#define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_
#pragma once

#include <vector>
#include "base/basictypes.h"

class AutomationProvider;

// Stores a list of all AutomationProvider objects.
class AutomationProviderList {
 public:
  ~AutomationProviderList();
  typedef std::vector<AutomationProvider*> list_type;
  typedef list_type::iterator iterator;
  typedef list_type::const_iterator const_iterator;

  // Adds and removes automation providers from the global list.
  bool AddProvider(AutomationProvider* provider);
  bool RemoveProvider(AutomationProvider* provider);

  const_iterator begin() {
    return automation_providers_.begin();
  }

  const_iterator end() {
    return automation_providers_.end();
  }

  size_t size() {
    return automation_providers_.size();
  }

  static AutomationProviderList* GetInstance();

 private:
  AutomationProviderList();
  void OnLastProviderRemoved();
  list_type automation_providers_;
  static AutomationProviderList* instance_;

  DISALLOW_COPY_AND_ASSIGN(AutomationProviderList);
};

#endif  // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_LIST_H_