| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/extensions/external_cache.h" | 5 #include "chrome/browser/chromeos/extensions/external_cache.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const PutExternalExtensionCallback& callback) { | 147 const PutExternalExtensionCallback& callback) { |
| 148 local_cache_.PutExtension( | 148 local_cache_.PutExtension( |
| 149 id, std::string(), crx_file_path, version, | 149 id, std::string(), crx_file_path, version, |
| 150 base::Bind(&ExternalCache::OnPutExternalExtension, | 150 base::Bind(&ExternalCache::OnPutExternalExtension, |
| 151 weak_ptr_factory_.GetWeakPtr(), id, callback)); | 151 weak_ptr_factory_.GetWeakPtr(), id, callback)); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ExternalCache::Observe(int type, | 154 void ExternalCache::Observe(int type, |
| 155 const content::NotificationSource& source, | 155 const content::NotificationSource& source, |
| 156 const content::NotificationDetails& details) { | 156 const content::NotificationDetails& details) { |
| 157 switch (type) { | 157 DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR, type); |
| 158 case extensions::NOTIFICATION_EXTENSION_INSTALL_ERROR: { | |
| 159 extensions::CrxInstaller* installer = | |
| 160 content::Source<extensions::CrxInstaller>(source).ptr(); | |
| 161 OnDamagedFileDetected(installer->source_file()); | |
| 162 break; | |
| 163 } | |
| 164 | 158 |
| 165 default: | 159 extensions::CrxInstaller* installer = |
| 166 NOTREACHED(); | 160 content::Source<extensions::CrxInstaller>(source).ptr(); |
| 167 } | 161 OnDamagedFileDetected(installer->source_file()); |
| 168 } | 162 } |
| 169 | 163 |
| 170 void ExternalCache::OnExtensionDownloadFailed( | 164 void ExternalCache::OnExtensionDownloadFailed( |
| 171 const std::string& id, | 165 const std::string& id, |
| 172 extensions::ExtensionDownloaderDelegate::Error error, | 166 extensions::ExtensionDownloaderDelegate::Error error, |
| 173 const extensions::ExtensionDownloaderDelegate::PingResult& ping_result, | 167 const extensions::ExtensionDownloaderDelegate::PingResult& ping_result, |
| 174 const std::set<int>& request_ids) { | 168 const std::set<int>& request_ids) { |
| 175 if (error == NO_UPDATE_AVAILABLE) { | 169 if (error == NO_UPDATE_AVAILABLE) { |
| 176 if (!cached_extensions_->HasKey(id)) { | 170 if (!cached_extensions_->HasKey(id)) { |
| 177 LOG(ERROR) << "ExternalCache extension " << id | 171 LOG(ERROR) << "ExternalCache extension " << id |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 OnPutExtension(id, file_path, file_ownership_passed); | 358 OnPutExtension(id, file_path, file_ownership_passed); |
| 365 callback.Run(id, !file_ownership_passed); | 359 callback.Run(id, !file_ownership_passed); |
| 366 } | 360 } |
| 367 | 361 |
| 368 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( | 362 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( |
| 369 const std::string& id) { | 363 const std::string& id) { |
| 370 return std::string(); | 364 return std::string(); |
| 371 } | 365 } |
| 372 | 366 |
| 373 } // namespace chromeos | 367 } // namespace chromeos |
| OLD | NEW |