| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/runtime/chrome_runtime_api_delegate.h" | 5 #include "chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 browser_context_, | 130 browser_context_, |
| 131 warnings)); | 131 warnings)); |
| 132 } else { | 132 } else { |
| 133 // We can't call ReloadExtension directly, since when this method finishes | 133 // We can't call ReloadExtension directly, since when this method finishes |
| 134 // it tries to decrease the reference count for the extension, which fails | 134 // it tries to decrease the reference count for the extension, which fails |
| 135 // if the extension has already been reloaded; so instead we post a task. | 135 // if the extension has already been reloaded; so instead we post a task. |
| 136 base::MessageLoop::current()->PostTask( | 136 base::MessageLoop::current()->PostTask( |
| 137 FROM_HERE, | 137 FROM_HERE, |
| 138 base::Bind(&ExtensionService::ReloadExtension, | 138 base::Bind(&ExtensionService::ReloadExtension, |
| 139 service->AsWeakPtr(), | 139 service->AsWeakPtr(), |
| 140 extension_id)); | 140 extension_id, |
| 141 true)); |
| 141 } | 142 } |
| 142 } | 143 } |
| 143 | 144 |
| 144 bool ChromeRuntimeAPIDelegate::CheckForUpdates( | 145 bool ChromeRuntimeAPIDelegate::CheckForUpdates( |
| 145 const std::string& extension_id, | 146 const std::string& extension_id, |
| 146 const UpdateCheckCallback& callback) { | 147 const UpdateCheckCallback& callback) { |
| 147 ExtensionSystem* system = ExtensionSystem::Get(browser_context_); | 148 ExtensionSystem* system = ExtensionSystem::Get(browser_context_); |
| 148 ExtensionService* service = system->extension_service(); | 149 ExtensionService* service = system->extension_service(); |
| 149 ExtensionUpdater* updater = service->updater(); | 150 ExtensionUpdater* updater = service->updater(); |
| 150 if (!updater) { | 151 if (!updater) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 const UpdateCheckResult& result) { | 276 const UpdateCheckResult& result) { |
| 276 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 277 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
| 277 pending_update_checks_.erase(extension_id); | 278 pending_update_checks_.erase(extension_id); |
| 278 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 279 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
| 279 iter != callbacks.end(); | 280 iter != callbacks.end(); |
| 280 ++iter) { | 281 ++iter) { |
| 281 const UpdateCheckCallback& callback = *iter; | 282 const UpdateCheckCallback& callback = *iter; |
| 282 callback.Run(result); | 283 callback.Run(result); |
| 283 } | 284 } |
| 284 } | 285 } |
| OLD | NEW |