| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/automation/automation_provider_list.h" | 5 #include "chrome/browser/automation/automation_provider_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/automation/automation_provider.h" | 9 #include "chrome/browser/automation/automation_provider.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return true; | 30 return true; |
| 31 } | 31 } |
| 32 | 32 |
| 33 bool AutomationProviderList::RemoveProvider(AutomationProvider* provider) { | 33 bool AutomationProviderList::RemoveProvider(AutomationProvider* provider) { |
| 34 const iterator remove_provider = | 34 const iterator remove_provider = |
| 35 find(automation_providers_.begin(), automation_providers_.end(), provider); | 35 find(automation_providers_.begin(), automation_providers_.end(), provider); |
| 36 if (remove_provider != automation_providers_.end()) { | 36 if (remove_provider != automation_providers_.end()) { |
| 37 (*remove_provider)->Release(); | 37 (*remove_provider)->Release(); |
| 38 automation_providers_.erase(remove_provider); | 38 automation_providers_.erase(remove_provider); |
| 39 g_browser_process->ReleaseModule(); | 39 g_browser_process->ReleaseModule(); |
| 40 if (automation_providers_.empty()) |
| 41 OnLastProviderRemoved(); |
| 40 return true; | 42 return true; |
| 41 } | 43 } |
| 42 return false; | 44 return false; |
| 43 } | 45 } |
| 44 | 46 |
| 45 AutomationProviderList* AutomationProviderList::GetInstance() { | 47 AutomationProviderList* AutomationProviderList::GetInstance() { |
| 46 if (!instance_) { | 48 if (!instance_) { |
| 47 instance_ = new AutomationProviderList; | 49 instance_ = new AutomationProviderList; |
| 48 } | 50 } |
| 49 DCHECK(NULL != instance_); | 51 DCHECK(NULL != instance_); |
| 50 return instance_; | 52 return instance_; |
| 51 } | 53 } |
| OLD | NEW |