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/download/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT); | 534 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT); |
535 break; | 535 break; |
536 case DownloadProtectionService::UNCOMMON: | 536 case DownloadProtectionService::UNCOMMON: |
537 item->OnContentCheckCompleted( | 537 item->OnContentCheckCompleted( |
538 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT); | 538 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT); |
539 break; | 539 break; |
540 case DownloadProtectionService::DANGEROUS_HOST: | 540 case DownloadProtectionService::DANGEROUS_HOST: |
541 item->OnContentCheckCompleted( | 541 item->OnContentCheckCompleted( |
542 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST); | 542 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST); |
543 break; | 543 break; |
544 case DownloadProtectionService::POTENTIALLY_UNWANTED: | |
benjhayden
2013/07/22 20:16:19
Maybe collapse these cases with item->OnContentChe
asanka
2013/07/23 15:10:36
Done.
| |
545 item->OnContentCheckCompleted( | |
546 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED); | |
547 break; | |
544 } | 548 } |
545 } | 549 } |
546 | 550 |
547 SafeBrowsingState* state = static_cast<SafeBrowsingState*>( | 551 SafeBrowsingState* state = static_cast<SafeBrowsingState*>( |
548 item->GetUserData(&safe_browsing_id)); | 552 item->GetUserData(&safe_browsing_id)); |
549 state->SetVerdict(result); | 553 state->SetVerdict(result); |
550 } | 554 } |
551 | 555 |
552 // content::NotificationObserver implementation. | 556 // content::NotificationObserver implementation. |
553 void ChromeDownloadManagerDelegate::Observe( | 557 void ChromeDownloadManagerDelegate::Observe( |
554 int type, | 558 int type, |
555 const content::NotificationSource& source, | 559 const content::NotificationSource& source, |
556 const content::NotificationDetails& details) { | 560 const content::NotificationDetails& details) { |
557 DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE); | 561 DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE); |
558 | 562 |
559 registrar_.Remove(this, | 563 registrar_.Remove(this, |
560 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 564 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
561 source); | 565 source); |
562 | 566 |
563 scoped_refptr<extensions::CrxInstaller> installer = | 567 scoped_refptr<extensions::CrxInstaller> installer = |
564 content::Source<extensions::CrxInstaller>(source).ptr(); | 568 content::Source<extensions::CrxInstaller>(source).ptr(); |
565 content::DownloadOpenDelayedCallback callback = | 569 content::DownloadOpenDelayedCallback callback = |
566 crx_installers_[installer.get()]; | 570 crx_installers_[installer.get()]; |
567 crx_installers_.erase(installer.get()); | 571 crx_installers_.erase(installer.get()); |
568 callback.Run(installer->did_handle_successfully()); | 572 callback.Run(installer->did_handle_successfully()); |
569 } | 573 } |
OLD | NEW |