| 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 "content/shell/shell_download_manager_delegate.h" | 5 #include "content/shell/shell_download_manager_delegate.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 &ShellDownloadManagerDelegate::GenerateFilename, | 84 &ShellDownloadManagerDelegate::GenerateFilename, |
| 85 this, download->GetId(), callback, generated_name, | 85 this, download->GetId(), callback, generated_name, |
| 86 default_download_path_)); | 86 default_download_path_)); |
| 87 return true; | 87 return true; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ShellDownloadManagerDelegate::ShouldOpenDownload( | 90 bool ShellDownloadManagerDelegate::ShouldOpenDownload( |
| 91 DownloadItem* item, | 91 DownloadItem* item, |
| 92 const DownloadOpenDelayedCallback& callback) { | 92 const DownloadOpenDelayedCallback& callback) { |
| 93 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree) && | 93 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree) && |
| 94 WebKitTestController::Get()->IsMainWindow(item->GetWebContents())) { | 94 WebKitTestController::Get()->IsMainWindow(item->GetWebContents()) && |
| 95 item->GetMimeType() == "text/html") { |
| 95 WebKitTestController::Get()->OpenURL( | 96 WebKitTestController::Get()->OpenURL( |
| 96 net::FilePathToFileURL(item->GetFullPath())); | 97 net::FilePathToFileURL(item->GetFullPath())); |
| 97 } | 98 } |
| 98 return true; | 99 return true; |
| 99 } | 100 } |
| 100 | 101 |
| 101 void ShellDownloadManagerDelegate::GenerateFilename( | 102 void ShellDownloadManagerDelegate::GenerateFilename( |
| 102 int32 download_id, | 103 int32 download_id, |
| 103 const DownloadTargetCallback& callback, | 104 const DownloadTargetCallback& callback, |
| 104 const base::FilePath& generated_name, | 105 const base::FilePath& generated_name, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); | 195 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( | 198 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( |
| 198 const base::FilePath& default_download_path) { | 199 const base::FilePath& default_download_path) { |
| 199 default_download_path_ = default_download_path; | 200 default_download_path_ = default_download_path; |
| 200 suppress_prompting_ = true; | 201 suppress_prompting_ = true; |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace content | 204 } // namespace content |
| OLD | NEW |