| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/extensions/api/system_indicator/system_indicator_manage
r.h" | 5 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r.h" |
| 6 | 6 |
| 7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 CreateOrUpdateIndicator( | 154 CreateOrUpdateIndicator( |
| 155 ExtensionRegistry::Get(profile_)->enabled_extensions().GetByID( | 155 ExtensionRegistry::Get(profile_)->enabled_extensions().GetByID( |
| 156 extension_id), | 156 extension_id), |
| 157 extension_action); | 157 extension_action); |
| 158 } else { | 158 } else { |
| 159 RemoveIndicator(extension_id); | 159 RemoveIndicator(extension_id); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool SystemIndicatorManager::SendClickEventToExtensionForTest( | 163 bool SystemIndicatorManager::SendClickEventToExtensionForTest( |
| 164 const std::string extension_id) { | 164 const std::string& extension_id) { |
| 165 | |
| 166 extensions::SystemIndicatorManager::SystemIndicatorMap::iterator it = | 165 extensions::SystemIndicatorManager::SystemIndicatorMap::iterator it = |
| 167 system_indicators_.find(extension_id); | 166 system_indicators_.find(extension_id); |
| 168 | 167 |
| 169 if (it == system_indicators_.end()) | 168 if (it == system_indicators_.end()) |
| 170 return false; | 169 return false; |
| 171 | 170 |
| 172 it->second->OnStatusIconClicked(); | 171 it->second->OnStatusIconClicked(); |
| 173 return true; | 172 return true; |
| 174 } | 173 } |
| 175 | 174 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 188 if (extension_icon) | 187 if (extension_icon) |
| 189 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); | 188 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); |
| 190 } | 189 } |
| 191 | 190 |
| 192 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { | 191 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { |
| 193 DCHECK(thread_checker_.CalledOnValidThread()); | 192 DCHECK(thread_checker_.CalledOnValidThread()); |
| 194 system_indicators_.erase(extension_id); | 193 system_indicators_.erase(extension_id); |
| 195 } | 194 } |
| 196 | 195 |
| 197 } // namespace extensions | 196 } // namespace extensions |
| OLD | NEW |