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

Side by Side Diff: chrome/browser/download/save_package_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: Attempt to fix win 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
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/save_package_file_picker.h" 5 #include "chrome/browser/download/save_package_file_picker.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/download/chrome_download_manager_delegate.h" 10 #include "chrome/browser/download/chrome_download_manager_delegate.h"
11 #include "chrome/browser/download/download_prefs.h" 11 #include "chrome/browser/download/download_prefs.h"
12 #include "chrome/browser/platform_util.h" 12 #include "chrome/browser/platform_util.h"
13 #include "chrome/browser/prefs/pref_member.h" 13 #include "chrome/browser/prefs/pref_member.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/chrome_select_file_policy.h"
16 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/download_manager.h" 19 #include "content/public/browser/download_manager.h"
19 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/save_page_type.h" 21 #include "content/public/browser/save_page_type.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
24 25
25 using content::RenderProcessHost; 26 using content::RenderProcessHost;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (!file_type_info.extensions[0][0].empty()) { 150 if (!file_type_info.extensions[0][0].empty()) {
150 // Drop the . 151 // Drop the .
151 file_type_info.extensions[0][0].erase(0, 1); 152 file_type_info.extensions[0][0].erase(0, 1);
152 } 153 }
153 154
154 file_type_info.include_all_files = true; 155 file_type_info.include_all_files = true;
155 file_type_index = 1; 156 file_type_index = 1;
156 } 157 }
157 158
158 if (g_should_prompt_for_filename) { 159 if (g_should_prompt_for_filename) {
159 select_file_dialog_ = SelectFileDialog::Create(this); 160 select_file_dialog_ = SelectFileDialog::Create(
161 this, new ChromeSelectFilePolicy(web_contents));
160 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 162 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
161 string16(), 163 string16(),
162 suggested_path, 164 suggested_path,
163 &file_type_info, 165 &file_type_info,
164 file_type_index, 166 file_type_index,
165 default_extension, 167 default_extension,
166 web_contents,
167 platform_util::GetTopLevel( 168 platform_util::GetTopLevel(
168 web_contents->GetNativeView()), 169 web_contents->GetNativeView()),
169 NULL); 170 NULL);
170 } else { 171 } else {
171 // Just use 'suggested_path' instead of opening the dialog prompt. 172 // Just use 'suggested_path' instead of opening the dialog prompt.
172 // Go through FileSelected() for consistency. 173 // Go through FileSelected() for consistency.
173 FileSelected(suggested_path, file_type_index, NULL); 174 FileSelected(suggested_path, file_type_index, NULL);
174 } 175 }
175 } 176 }
176 177
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 221
221 callback_.Run(path, save_type, base::Bind(&OnSavePackageDownloadCreated)); 222 callback_.Run(path, save_type, base::Bind(&OnSavePackageDownloadCreated));
222 } 223 }
223 224
224 delete this; 225 delete this;
225 } 226 }
226 227
227 void SavePackageFilePicker::FileSelectionCanceled(void* unused_params) { 228 void SavePackageFilePicker::FileSelectionCanceled(void* unused_params) {
228 delete this; 229 delete this;
229 } 230 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file_picker.cc ('k') | chrome/browser/download/save_package_file_picker_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698