| 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/webstore_installer.h" | 5 #include "chrome/browser/extensions/webstore_installer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 void WebstoreInstaller::Observe(int type, | 331 void WebstoreInstaller::Observe(int type, |
| 332 const content::NotificationSource& source, | 332 const content::NotificationSource& source, |
| 333 const content::NotificationDetails& details) { | 333 const content::NotificationDetails& details) { |
| 334 switch (type) { | 334 switch (type) { |
| 335 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { | 335 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { |
| 336 const Extension* extension = | 336 const Extension* extension = |
| 337 content::Details<const Extension>(details).ptr(); | 337 content::Details<const Extension>(details).ptr(); |
| 338 CrxInstaller* installer = content::Source<CrxInstaller>(source).ptr(); | 338 CrxInstaller* installer = content::Source<CrxInstaller>(source).ptr(); |
| 339 if (extension == NULL && download_item_ != NULL && | 339 if (extension == NULL && download_item_ != NULL && |
| 340 installer->download_url() == download_item_->GetURL() && | 340 installer->download_id() == download_item_->GetId() && |
| 341 installer->profile()->IsSameProfile(profile_)) { | 341 installer->profile()->IsSameProfile(profile_)) { |
| 342 ReportFailure(kInstallCanceledError, FAILURE_REASON_CANCELLED); | 342 ReportFailure(kInstallCanceledError, FAILURE_REASON_CANCELLED); |
| 343 } | 343 } |
| 344 break; | 344 break; |
| 345 } | 345 } |
| 346 | 346 |
| 347 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { | 347 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
| 348 CHECK(profile_->IsSameProfile(content::Source<Profile>(source).ptr())); | 348 CHECK(profile_->IsSameProfile(content::Source<Profile>(source).ptr())); |
| 349 const Extension* extension = | 349 const Extension* extension = |
| 350 content::Details<const InstalledExtensionInfo>(details)->extension; | 350 content::Details<const InstalledExtensionInfo>(details)->extension; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr(); | 382 CrxInstaller* crx_installer = content::Source<CrxInstaller>(source).ptr(); |
| 383 CHECK(crx_installer); | 383 CHECK(crx_installer); |
| 384 if (!profile_->IsSameProfile(crx_installer->profile())) | 384 if (!profile_->IsSameProfile(crx_installer->profile())) |
| 385 return; | 385 return; |
| 386 | 386 |
| 387 // TODO(rdevlin.cronin): Continue removing std::string errors and | 387 // TODO(rdevlin.cronin): Continue removing std::string errors and |
| 388 // replacing with base::string16. See crbug.com/71980. | 388 // replacing with base::string16. See crbug.com/71980. |
| 389 const base::string16* error = | 389 const base::string16* error = |
| 390 content::Details<const base::string16>(details).ptr(); | 390 content::Details<const base::string16>(details).ptr(); |
| 391 const std::string utf8_error = base::UTF16ToUTF8(*error); | 391 const std::string utf8_error = base::UTF16ToUTF8(*error); |
| 392 if (download_url_ == crx_installer->original_download_url()) | 392 if (download_item_->GetId() == crx_installer->download_id()) |
| 393 ReportFailure(utf8_error, FAILURE_REASON_OTHER); | 393 ReportFailure(utf8_error, FAILURE_REASON_OTHER); |
| 394 break; | 394 break; |
| 395 } | 395 } |
| 396 | 396 |
| 397 default: | 397 default: |
| 398 NOTREACHED(); | 398 NOTREACHED(); |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | 401 |
| 402 void WebstoreInstaller::InvalidateDelegate() { | 402 void WebstoreInstaller::InvalidateDelegate() { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 1, | 693 1, |
| 694 kMaxSizeKb, | 694 kMaxSizeKb, |
| 695 kNumBuckets); | 695 kNumBuckets); |
| 696 } | 696 } |
| 697 UMA_HISTOGRAM_BOOLEAN( | 697 UMA_HISTOGRAM_BOOLEAN( |
| 698 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", | 698 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", |
| 699 total_bytes <= 0); | 699 total_bytes <= 0); |
| 700 } | 700 } |
| 701 | 701 |
| 702 } // namespace extensions | 702 } // namespace extensions |
| OLD | NEW |