OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/download/download_file_picker.h" | 5 #include "chrome/browser/download/download_file_picker.h" |
6 | 6 |
7 #include "chrome/browser/download/download_prefs.h" | 7 #include "chrome/browser/download/download_prefs.h" |
8 #include "chrome/browser/platform_util.h" | 8 #include "chrome/browser/platform_util.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/browser/download/save_package.h" | 10 #include "content/browser/download/save_package.h" |
11 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 DownloadFilePicker::DownloadFilePicker( | 15 DownloadFilePicker::DownloadFilePicker( |
16 DownloadManager* download_manager, | 16 DownloadManagerInterface* download_manager, |
17 TabContents* tab_contents, | 17 TabContents* tab_contents, |
18 const FilePath& suggested_path, | 18 const FilePath& suggested_path, |
19 void* params) | 19 void* params) |
20 : download_manager_(download_manager) { | 20 : download_manager_(download_manager) { |
21 select_file_dialog_ = SelectFileDialog::Create(this); | 21 select_file_dialog_ = SelectFileDialog::Create(this); |
22 SelectFileDialog::FileTypeInfo file_type_info; | 22 SelectFileDialog::FileTypeInfo file_type_info; |
23 FilePath::StringType extension = suggested_path.Extension(); | 23 FilePath::StringType extension = suggested_path.Extension(); |
24 if (!extension.empty()) { | 24 if (!extension.empty()) { |
25 extension.erase(extension.begin()); // drop the . | 25 extension.erase(extension.begin()); // drop the . |
26 file_type_info.extensions.resize(1); | 26 file_type_info.extensions.resize(1); |
(...skipping 26 matching lines...) Expand all Loading... |
53 if (download_manager_) | 53 if (download_manager_) |
54 download_manager_->FileSelected(path, params); | 54 download_manager_->FileSelected(path, params); |
55 delete this; | 55 delete this; |
56 } | 56 } |
57 | 57 |
58 void DownloadFilePicker::FileSelectionCanceled(void* params) { | 58 void DownloadFilePicker::FileSelectionCanceled(void* params) { |
59 if (download_manager_) | 59 if (download_manager_) |
60 download_manager_->FileSelectionCanceled(params); | 60 download_manager_->FileSelectionCanceled(params); |
61 delete this; | 61 delete this; |
62 } | 62 } |
OLD | NEW |