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

Side by Side Diff: content/shell/shell_download_manager_delegate.cc

Issue 10809016: Move content_shell and content_browsertests code into the content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix android Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/shell_devtools_delegate.h ('k') | content/shell/shell_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <commdlg.h> 9 #include <commdlg.h>
10 #endif 10 #endif
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 bool ShellDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { 38 bool ShellDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
39 DownloadItem* download = 39 DownloadItem* download =
40 download_manager_->GetActiveDownloadItem(download_id); 40 download_manager_->GetActiveDownloadItem(download_id);
41 41
42 if (!download->GetForcedFilePath().empty()) { 42 if (!download->GetForcedFilePath().empty()) {
43 download->OnTargetPathDetermined( 43 download->OnTargetPathDetermined(
44 download->GetForcedFilePath(), 44 download->GetForcedFilePath(),
45 DownloadItem::TARGET_DISPOSITION_OVERWRITE, 45 DownloadItem::TARGET_DISPOSITION_OVERWRITE,
46 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 46 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
47 return true; 47 return true;
48 } 48 }
49 49
50 FilePath generated_name = net::GenerateFileName( 50 FilePath generated_name = net::GenerateFileName(
51 download->GetURL(), 51 download->GetURL(),
52 download->GetContentDisposition(), 52 download->GetContentDisposition(),
53 download->GetReferrerCharset(), 53 download->GetReferrerCharset(),
54 download->GetSuggestedFilename(), 54 download->GetSuggestedFilename(),
55 download->GetMimeType(), 55 download->GetMimeType(),
56 "download"); 56 "download");
(...skipping 28 matching lines...) Expand all
85 int32 download_id, 85 int32 download_id,
86 const FilePath& suggested_path) { 86 const FilePath& suggested_path) {
87 DownloadItem* download = 87 DownloadItem* download =
88 download_manager_->GetActiveDownloadItem(download_id); 88 download_manager_->GetActiveDownloadItem(download_id);
89 if (!download) 89 if (!download)
90 return; 90 return;
91 91
92 // Since we have no download UI, show the user a dialog always. 92 // Since we have no download UI, show the user a dialog always.
93 download->OnTargetPathDetermined(suggested_path, 93 download->OnTargetPathDetermined(suggested_path,
94 DownloadItem::TARGET_DISPOSITION_PROMPT, 94 DownloadItem::TARGET_DISPOSITION_PROMPT,
95 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); 95 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
96 download_manager_->RestartDownload(download_id); 96 download_manager_->RestartDownload(download_id);
97 } 97 }
98 98
99 void ShellDownloadManagerDelegate::ChooseDownloadPath(DownloadItem* item) { 99 void ShellDownloadManagerDelegate::ChooseDownloadPath(DownloadItem* item) {
100 FilePath result; 100 FilePath result;
101 #if defined(OS_WIN) && !defined(USE_AURA) 101 #if defined(OS_WIN) && !defined(USE_AURA)
102 const FilePath suggested_path(item->GetTargetFilePath()); 102 const FilePath suggested_path(item->GetTargetFilePath());
103 std::wstring file_part = FilePath(suggested_path).BaseName().value(); 103 std::wstring file_part = FilePath(suggested_path).BaseName().value();
104 wchar_t file_name[MAX_PATH]; 104 wchar_t file_name[MAX_PATH];
105 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); 105 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name));
(...skipping 19 matching lines...) Expand all
125 #endif 125 #endif
126 126
127 if (result.empty()) { 127 if (result.empty()) {
128 download_manager_->FileSelectionCanceled(item->GetId()); 128 download_manager_->FileSelectionCanceled(item->GetId());
129 } else { 129 } else {
130 download_manager_->FileSelected(result, item->GetId()); 130 download_manager_->FileSelected(result, item->GetId());
131 } 131 }
132 } 132 }
133 133
134 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_devtools_delegate.h ('k') | content/shell/shell_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698