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
3 // found in the LICENSE file.
5 #include "chrome/browser/automation/automation_provider_list.h"
9 #include "base/logging.h"
10 #include "chrome/browser/automation/automation_provider.h"
12 AutomationProviderList::AutomationProviderList() {
15 AutomationProviderList::~AutomationProviderList() {
16 iterator iter
= automation_providers_
.begin();
17 while (iter
!= automation_providers_
.end()) {
19 iter
= automation_providers_
.erase(iter
);
23 bool AutomationProviderList::AddProvider(AutomationProvider
* provider
) {
25 automation_providers_
.push_back(provider
);
29 bool AutomationProviderList::RemoveProvider(AutomationProvider
* provider
) {
30 const iterator remove_provider
=
31 std::find(automation_providers_
.begin(), automation_providers_
.end(),
33 if (remove_provider
!= automation_providers_
.end()) {
34 (*remove_provider
)->Release();
35 automation_providers_
.erase(remove_provider
);
36 if (automation_providers_
.empty())
37 OnLastProviderRemoved();