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 "chrome/browser/download/download_file_picker.h" | 5 #include "chrome/browser/download/download_file_picker.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
9 #include "chrome/browser/platform_util.h" | 9 #include "chrome/browser/platform_util.h" |
10 #include "content/public/browser/download_item.h" | 10 #include "content/public/browser/download_item.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const FilePath& actual_path) { | 47 const FilePath& actual_path) { |
48 if (suggested_path == actual_path) | 48 if (suggested_path == actual_path) |
49 return FILE_PICKER_SAME; | 49 return FILE_PICKER_SAME; |
50 if (suggested_path.DirName() != actual_path.DirName()) | 50 if (suggested_path.DirName() != actual_path.DirName()) |
51 return FILE_PICKER_DIFFERENT_DIR; | 51 return FILE_PICKER_DIFFERENT_DIR; |
52 return FILE_PICKER_DIFFERENT_NAME; | 52 return FILE_PICKER_DIFFERENT_NAME; |
53 } | 53 } |
54 | 54 |
55 } // namespace | 55 } // namespace |
56 | 56 |
57 DownloadFilePicker::DownloadFilePicker() { | 57 DownloadFilePicker::DownloadFilePicker() : download_id_(0) { |
58 } | 58 } |
59 | 59 |
60 void DownloadFilePicker::Init(DownloadManager* download_manager, | 60 void DownloadFilePicker::Init(DownloadManager* download_manager, |
61 DownloadItem* item) { | 61 DownloadItem* item) { |
62 download_manager_ = download_manager; | 62 download_manager_ = download_manager; |
63 download_id_ = item->GetId(); | 63 download_id_ = item->GetId(); |
64 InitSuggestedPath(item); | 64 InitSuggestedPath(item); |
65 | 65 |
66 DCHECK(download_manager_); | 66 DCHECK(download_manager_); |
67 select_file_dialog_ = SelectFileDialog::Create(this); | 67 select_file_dialog_ = SelectFileDialog::Create(this); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 download_manager_->FileSelected(path, download_id_); | 105 download_manager_->FileSelected(path, download_id_); |
106 delete this; | 106 delete this; |
107 } | 107 } |
108 | 108 |
109 void DownloadFilePicker::FileSelectionCanceled(void* params) { | 109 void DownloadFilePicker::FileSelectionCanceled(void* params) { |
110 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); | 110 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); |
111 if (download_manager_) | 111 if (download_manager_) |
112 download_manager_->FileSelectionCanceled(download_id_); | 112 download_manager_->FileSelectionCanceled(download_id_); |
113 delete this; | 113 delete this; |
114 } | 114 } |
OLD | NEW |