blob: a4d95404f7c3c41541591e2b3ee8dbe79b9430f9 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/browser/layout_test/layout_test_download_manager_delegate.h"
#if defined(OS_WIN)
#include <windows.h>
#include <commdlg.h>
#endif
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager.h"
#include "content/shell/browser/webkit_test_controller.h"
#include "net/base/filename_util.h"
#if defined(OS_WIN)
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#endif
namespace content {
LayoutTestDownloadManagerDelegate::LayoutTestDownloadManagerDelegate()
: ShellDownloadManagerDelegate() {}
LayoutTestDownloadManagerDelegate::~LayoutTestDownloadManagerDelegate(){
}
bool LayoutTestDownloadManagerDelegate::ShouldOpenDownload(
DownloadItem* item,
const DownloadOpenDelayedCallback& callback) {
if (WebKitTestController::Get()->IsMainWindow(item->GetWebContents()) &&
item->GetMimeType() == "text/html") {
WebKitTestController::Get()->OpenURL(
net::FilePathToFileURL(item->GetFullPath()));
}
return true;
}
} // namespace content