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/save_package_file_picker.h" | 5 #include "chrome/browser/download/save_package_file_picker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (ShouldSaveAsMHTML()) { | 235 if (ShouldSaveAsMHTML()) { |
236 save_type = content::SAVE_PAGE_TYPE_AS_MHTML; | 236 save_type = content::SAVE_PAGE_TYPE_AS_MHTML; |
237 } else { | 237 } else { |
238 #if defined(OS_CHROMEOS) | 238 #if defined(OS_CHROMEOS) |
239 save_type = content::SAVE_PAGE_TYPE_AS_ONLY_HTML; | 239 save_type = content::SAVE_PAGE_TYPE_AS_ONLY_HTML; |
240 #else | 240 #else |
241 // The option index is not zero-based. | 241 // The option index is not zero-based. |
242 DCHECK(index >= kSelectFileHtmlOnlyIndex && | 242 DCHECK(index >= kSelectFileHtmlOnlyIndex && |
243 index <= kSelectFileCompleteIndex); | 243 index <= kSelectFileCompleteIndex); |
244 save_type = kIndexToSaveType[index]; | 244 save_type = kIndexToSaveType[index]; |
245 if (select_file_dialog_ && | 245 if (select_file_dialog_.get() && |
246 select_file_dialog_->HasMultipleFileTypeChoices()) | 246 select_file_dialog_->HasMultipleFileTypeChoices()) |
247 download_prefs_->SetSaveFileType(save_type); | 247 download_prefs_->SetSaveFileType(save_type); |
248 #endif | 248 #endif |
249 } | 249 } |
250 | 250 |
251 UMA_HISTOGRAM_ENUMERATION("Download.SavePageType", | 251 UMA_HISTOGRAM_ENUMERATION("Download.SavePageType", |
252 save_type, | 252 save_type, |
253 content::SAVE_PAGE_TYPE_MAX); | 253 content::SAVE_PAGE_TYPE_MAX); |
254 | 254 |
255 base::FilePath path_copy(path); | 255 base::FilePath path_copy(path); |
(...skipping 22 matching lines...) Expand all Loading... |
278 } | 278 } |
279 #endif | 279 #endif |
280 | 280 |
281 callback_.Run(path_copy, save_type, | 281 callback_.Run(path_copy, save_type, |
282 base::Bind(&OnSavePackageDownloadCreated)); | 282 base::Bind(&OnSavePackageDownloadCreated)); |
283 } | 283 } |
284 | 284 |
285 void SavePackageFilePicker::FileSelectionCanceled(void* unused_params) { | 285 void SavePackageFilePicker::FileSelectionCanceled(void* unused_params) { |
286 delete this; | 286 delete this; |
287 } | 287 } |
OLD | NEW |