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

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

Issue 137993009: Remove more non-aura windows code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: renable the disabled tests Created 6 years, 11 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/browser/shell.cc ('k') | content/shell/browser/shell_win.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/shell_download_manager_delegate.h" 5 #include "content/shell/browser/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 10 matching lines...) Expand all
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/download_manager.h" 24 #include "content/public/browser/download_manager.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/browser/web_contents_view.h" 26 #include "content/public/browser/web_contents_view.h"
27 #include "content/shell/browser/webkit_test_controller.h" 27 #include "content/shell/browser/webkit_test_controller.h"
28 #include "content/shell/common/shell_switches.h" 28 #include "content/shell/common/shell_switches.h"
29 #include "net/base/net_util.h" 29 #include "net/base/net_util.h"
30 30
31 #if defined(OS_WIN)
32 #include "ui/aura/root_window.h"
33 #include "ui/aura/window.h"
34 #endif
35
31 namespace content { 36 namespace content {
32 37
33 ShellDownloadManagerDelegate::ShellDownloadManagerDelegate() 38 ShellDownloadManagerDelegate::ShellDownloadManagerDelegate()
34 : download_manager_(NULL), 39 : download_manager_(NULL),
35 suppress_prompting_(false), 40 suppress_prompting_(false),
36 weak_ptr_factory_(this) {} 41 weak_ptr_factory_(this) {}
37 42
38 ShellDownloadManagerDelegate::~ShellDownloadManagerDelegate(){ 43 ShellDownloadManagerDelegate::~ShellDownloadManagerDelegate(){
39 if (download_manager_) { 44 if (download_manager_) {
40 DCHECK_EQ(static_cast<DownloadManagerDelegate*>(this), 45 DCHECK_EQ(static_cast<DownloadManagerDelegate*>(this),
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void ShellDownloadManagerDelegate::ChooseDownloadPath( 161 void ShellDownloadManagerDelegate::ChooseDownloadPath(
157 uint32 download_id, 162 uint32 download_id,
158 const DownloadTargetCallback& callback, 163 const DownloadTargetCallback& callback,
159 const base::FilePath& suggested_path) { 164 const base::FilePath& suggested_path) {
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
161 DownloadItem* item = download_manager_->GetDownload(download_id); 166 DownloadItem* item = download_manager_->GetDownload(download_id);
162 if (!item || (item->GetState() != DownloadItem::IN_PROGRESS)) 167 if (!item || (item->GetState() != DownloadItem::IN_PROGRESS))
163 return; 168 return;
164 169
165 base::FilePath result; 170 base::FilePath result;
166 #if defined(OS_WIN) && !defined(USE_AURA) 171 #if defined(OS_WIN)
167 std::wstring file_part = base::FilePath(suggested_path).BaseName().value(); 172 std::wstring file_part = base::FilePath(suggested_path).BaseName().value();
168 wchar_t file_name[MAX_PATH]; 173 wchar_t file_name[MAX_PATH];
169 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); 174 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name));
170 OPENFILENAME save_as; 175 OPENFILENAME save_as;
171 ZeroMemory(&save_as, sizeof(save_as)); 176 ZeroMemory(&save_as, sizeof(save_as));
172 save_as.lStructSize = sizeof(OPENFILENAME); 177 save_as.lStructSize = sizeof(OPENFILENAME);
173 save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView(); 178 save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView()->
179 GetDispatcher()->host()->GetAcceleratedWidget();
174 save_as.lpstrFile = file_name; 180 save_as.lpstrFile = file_name;
175 save_as.nMaxFile = arraysize(file_name); 181 save_as.nMaxFile = arraysize(file_name);
176 182
177 std::wstring directory; 183 std::wstring directory;
178 if (!suggested_path.empty()) 184 if (!suggested_path.empty())
179 directory = suggested_path.DirName().value(); 185 directory = suggested_path.DirName().value();
180 186
181 save_as.lpstrInitialDir = directory.c_str(); 187 save_as.lpstrInitialDir = directory.c_str();
182 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | 188 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING |
183 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; 189 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); 222 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result);
217 } 223 }
218 224
219 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( 225 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting(
220 const base::FilePath& default_download_path) { 226 const base::FilePath& default_download_path) {
221 default_download_path_ = default_download_path; 227 default_download_path_ = default_download_path;
222 suppress_prompting_ = true; 228 suppress_prompting_ = true;
223 } 229 }
224 230
225 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell.cc ('k') | content/shell/browser/shell_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698