Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: content/shell/browser/layout_test/layout_test_download_manager_delegate.cc

Issue 648673002: Content Shell: Introduce LayoutTestDownloadManagerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@637843003
Patch Set: Ugh. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/layout_test/layout_test_download_manager_delegate.cc
diff --git a/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a4d95404f7c3c41541591e2b3ee8dbe79b9430f9
--- /dev/null
+++ b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc
@@ -0,0 +1,45 @@
+// 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

Powered by Google App Engine
This is Rietveld 408576698