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

Side by Side Diff: chrome/browser/download/download_file_picker.cc

Issue 10667026: Start consolidating cross-port file selection code into ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
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 "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/chrome_select_file_policy.h"
8 #include "chrome/browser/download/download_prefs.h" 9 #include "chrome/browser/download/download_prefs.h"
9 #include "chrome/browser/platform_util.h" 10 #include "chrome/browser/platform_util.h"
10 #include "content/public/browser/download_item.h" 11 #include "content/public/browser/download_item.h"
11 #include "content/public/browser/download_manager.h" 12 #include "content/public/browser/download_manager.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 using content::DownloadItem; 17 using content::DownloadItem;
17 using content::DownloadManager; 18 using content::DownloadManager;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (!extension.empty()) { 71 if (!extension.empty()) {
71 extension.erase(extension.begin()); // drop the . 72 extension.erase(extension.begin()); // drop the .
72 file_type_info.extensions.resize(1); 73 file_type_info.extensions.resize(1);
73 file_type_info.extensions[0].push_back(extension); 74 file_type_info.extensions[0].push_back(extension);
74 } 75 }
75 file_type_info.include_all_files = true; 76 file_type_info.include_all_files = true;
76 WebContents* web_contents = item->GetWebContents(); 77 WebContents* web_contents = item->GetWebContents();
77 gfx::NativeWindow owning_window = web_contents ? 78 gfx::NativeWindow owning_window = web_contents ?
78 platform_util::GetTopLevel(web_contents->GetNativeView()) : NULL; 79 platform_util::GetTopLevel(web_contents->GetNativeView()) : NULL;
79 80
80 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 81 select_file_dialog_->SelectFile(
81 string16(), 82 SelectFileDialog::SELECT_SAVEAS_FILE,
82 suggested_path_, 83 string16(),
83 &file_type_info, 0, FILE_PATH_LITERAL(""), 84 suggested_path_,
84 web_contents, owning_window, NULL); 85 &file_type_info,
86 0,
87 FILE_PATH_LITERAL(""),
88 ChromeSelectFilePolicy::DisplayInfobarCallback(web_contents),
89 owning_window,
90 NULL);
85 } 91 }
86 92
87 DownloadFilePicker::~DownloadFilePicker() { 93 DownloadFilePicker::~DownloadFilePicker() {
88 } 94 }
89 95
90 void DownloadFilePicker::InitSuggestedPath(DownloadItem* item) { 96 void DownloadFilePicker::InitSuggestedPath(DownloadItem* item) {
91 set_suggested_path(item->GetTargetFilePath()); 97 set_suggested_path(item->GetTargetFilePath());
92 } 98 }
93 99
94 void DownloadFilePicker::RecordFileSelected(const FilePath& path) { 100 void DownloadFilePicker::RecordFileSelected(const FilePath& path) {
(...skipping 10 matching lines...) Expand all
105 download_manager_->FileSelected(path, download_id_); 111 download_manager_->FileSelected(path, download_id_);
106 delete this; 112 delete this;
107 } 113 }
108 114
109 void DownloadFilePicker::FileSelectionCanceled(void* params) { 115 void DownloadFilePicker::FileSelectionCanceled(void* params) {
110 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); 116 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL);
111 if (download_manager_) 117 if (download_manager_)
112 download_manager_->FileSelectionCanceled(download_id_); 118 download_manager_->FileSelectionCanceled(download_id_);
113 delete this; 119 delete this;
114 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698