Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / automation / automation_provider_list.cc
blob6cd1f9979097de8cf9f523584f9e829f4b5c8706
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"
7 #include <algorithm>
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()) {
18 (*iter)->Release();
19 iter = automation_providers_.erase(iter);
23 bool AutomationProviderList::AddProvider(AutomationProvider* provider) {
24 provider->AddRef();
25 automation_providers_.push_back(provider);
26 return true;
29 bool AutomationProviderList::RemoveProvider(AutomationProvider* provider) {
30 const iterator remove_provider =
31 std::find(automation_providers_.begin(), automation_providers_.end(),
32 provider);
33 if (remove_provider != automation_providers_.end()) {
34 (*remove_provider)->Release();
35 automation_providers_.erase(remove_provider);
36 if (automation_providers_.empty())
37 OnLastProviderRemoved();
38 return true;
40 return false;