| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/image_writer_private/operation_manager.h
" | 5 #include "chrome/browser/extensions/api/image_writer_private/operation_manager.h
" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 void OperationManager::DeleteOperation(const ExtensionId& extension_id) { | 234 void OperationManager::DeleteOperation(const ExtensionId& extension_id) { |
| 235 OperationMap::iterator existing_operation = operations_.find(extension_id); | 235 OperationMap::iterator existing_operation = operations_.find(extension_id); |
| 236 if (existing_operation != operations_.end()) { | 236 if (existing_operation != operations_.end()) { |
| 237 operations_.erase(existing_operation); | 237 operations_.erase(existing_operation); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 void OperationManager::OnExtensionUnloaded( | 241 void OperationManager::OnExtensionUnloaded( |
| 242 content::BrowserContext* browser_context, | 242 content::BrowserContext* browser_context, |
| 243 const Extension* extension, | 243 const Extension* extension, |
| 244 UnloadedExtensionInfo::Reason reason) { | 244 UnloadedExtensionReason reason) { |
| 245 DeleteOperation(extension->id()); | 245 DeleteOperation(extension->id()); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void OperationManager::Observe(int type, | 248 void OperationManager::Observe(int type, |
| 249 const content::NotificationSource& source, | 249 const content::NotificationSource& source, |
| 250 const content::NotificationDetails& details) { | 250 const content::NotificationDetails& details) { |
| 251 switch (type) { | 251 switch (type) { |
| 252 case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { | 252 case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { |
| 253 DeleteOperation(content::Details<const Extension>(details).ptr()->id()); | 253 DeleteOperation(content::Details<const Extension>(details).ptr()->id()); |
| 254 break; | 254 break; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 276 DestructorAtExit g_factory = LAZY_INSTANCE_INITIALIZER; | 276 DestructorAtExit g_factory = LAZY_INSTANCE_INITIALIZER; |
| 277 | 277 |
| 278 BrowserContextKeyedAPIFactory<OperationManager>* | 278 BrowserContextKeyedAPIFactory<OperationManager>* |
| 279 OperationManager::GetFactoryInstance() { | 279 OperationManager::GetFactoryInstance() { |
| 280 return g_factory.Pointer(); | 280 return g_factory.Pointer(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 } // namespace image_writer | 284 } // namespace image_writer |
| 285 } // namespace extensions | 285 } // namespace extensions |
| OLD | NEW |