use DownloadItem to determine download initiator

This commit is contained in:
deepak1556 2016-04-27 20:29:39 +05:30
parent 46208b5b3e
commit 6dbd2ce243
3 changed files with 2 additions and 12 deletions

View file

@ -9,9 +9,7 @@
#include "atom/browser/api/atom_api_cookies.h"
#include "atom/browser/api/atom_api_download_item.h"
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/api/atom_api_web_request.h"
#include "atom/browser/api/save_page_handler.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_permission_manager.h"
@ -306,8 +304,7 @@ Session::~Session() {
void Session::OnDownloadCreated(content::DownloadManager* manager,
content::DownloadItem* item) {
auto web_contents = item->GetWebContents();
if (SavePageHandler::IsSavePageTypes(item->GetMimeType()))
if (item->IsSavePackageDownload())
return;
v8::Locker locker(isolate());
@ -315,7 +312,7 @@ void Session::OnDownloadCreated(content::DownloadManager* manager,
bool prevent_default = Emit(
"will-download",
DownloadItem::Create(isolate(), item),
web_contents);
item->GetWebContents());
if (prevent_default) {
item->Cancel(true);
item->Remove();