| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!browser) | 244 if (!browser) |
| 245 return false; | 245 return false; |
| 246 return extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser); | 246 return extensions::ExtensionTabUtil::OpenOptionsPage(extension, browser); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void ChromeRuntimeAPIDelegate::Observe( | 249 void ChromeRuntimeAPIDelegate::Observe( |
| 250 int type, | 250 int type, |
| 251 const content::NotificationSource& source, | 251 const content::NotificationSource& source, |
| 252 const content::NotificationDetails& details) { | 252 const content::NotificationDetails& details) { |
| 253 DCHECK(type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND); | 253 DCHECK(type == extensions::NOTIFICATION_EXTENSION_UPDATE_FOUND); |
| 254 typedef const std::pair<std::string, base::Version> UpdateDetails; | 254 typedef const std::pair<std::string, Version> UpdateDetails; |
| 255 const std::string& id = content::Details<UpdateDetails>(details)->first; | 255 const std::string& id = content::Details<UpdateDetails>(details)->first; |
| 256 const base::Version& version = | 256 const Version& version = content::Details<UpdateDetails>(details)->second; |
| 257 content::Details<UpdateDetails>(details)->second; | |
| 258 if (version.IsValid()) { | 257 if (version.IsValid()) { |
| 259 CallUpdateCallbacks( | 258 CallUpdateCallbacks( |
| 260 id, UpdateCheckResult(true, kUpdateFound, version.GetString())); | 259 id, UpdateCheckResult(true, kUpdateFound, version.GetString())); |
| 261 } | 260 } |
| 262 } | 261 } |
| 263 | 262 |
| 264 void ChromeRuntimeAPIDelegate::UpdateCheckComplete( | 263 void ChromeRuntimeAPIDelegate::UpdateCheckComplete( |
| 265 const std::string& extension_id) { | 264 const std::string& extension_id) { |
| 266 ExtensionSystem* system = ExtensionSystem::Get(browser_context_); | 265 ExtensionSystem* system = ExtensionSystem::Get(browser_context_); |
| 267 ExtensionService* service = system->extension_service(); | 266 ExtensionService* service = system->extension_service(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 281 const UpdateCheckResult& result) { | 280 const UpdateCheckResult& result) { |
| 282 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; | 281 UpdateCallbackList callbacks = pending_update_checks_[extension_id]; |
| 283 pending_update_checks_.erase(extension_id); | 282 pending_update_checks_.erase(extension_id); |
| 284 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); | 283 for (UpdateCallbackList::const_iterator iter = callbacks.begin(); |
| 285 iter != callbacks.end(); | 284 iter != callbacks.end(); |
| 286 ++iter) { | 285 ++iter) { |
| 287 const UpdateCheckCallback& callback = *iter; | 286 const UpdateCheckCallback& callback = *iter; |
| 288 callback.Run(result); | 287 callback.Run(result); |
| 289 } | 288 } |
| 290 } | 289 } |
| OLD | NEW |