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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/public/pref_member.h" | 10 #include "base/prefs/public/pref_member.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 UMA_HISTOGRAM_ENUMERATION("Download.SavePageType", | 205 UMA_HISTOGRAM_ENUMERATION("Download.SavePageType", |
206 save_type, | 206 save_type, |
207 content::SAVE_PAGE_TYPE_MAX); | 207 content::SAVE_PAGE_TYPE_MAX); |
208 | 208 |
209 StringPrefMember save_file_path; | 209 StringPrefMember save_file_path; |
210 save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs); | 210 save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs); |
211 #if defined(OS_POSIX) | 211 #if defined(OS_POSIX) |
212 std::string path_string = path.DirName().value(); | 212 std::string path_string = path.DirName().value(); |
213 #elif defined(OS_WIN) | 213 #elif defined(OS_WIN) |
214 std::string path_string = WideToUTF8(path.DirName().value()); | 214 std::string path_string = base::WideToUTF8(path.DirName().value()); |
215 #endif | 215 #endif |
216 // If user change the default saving directory, we will remember it just | 216 // If user change the default saving directory, we will remember it just |
217 // like IE and FireFox. | 217 // like IE and FireFox. |
218 if (!process->GetBrowserContext()->IsOffTheRecord() && | 218 if (!process->GetBrowserContext()->IsOffTheRecord() && |
219 save_file_path.GetValue() != path_string) | 219 save_file_path.GetValue() != path_string) |
220 save_file_path.SetValue(path_string); | 220 save_file_path.SetValue(path_string); |
221 | 221 |
222 callback_.Run(path, save_type, base::Bind(&OnSavePackageDownloadCreated)); | 222 callback_.Run(path, save_type, base::Bind(&OnSavePackageDownloadCreated)); |
223 } | 223 } |
224 | 224 |
225 delete this; | 225 delete this; |
226 } | 226 } |
227 | 227 |
228 void SavePackageFilePicker::FileSelectionCanceled(void* unused_params) { | 228 void SavePackageFilePicker::FileSelectionCanceled(void* unused_params) { |
229 delete this; | 229 delete this; |
230 } | 230 } |
OLD | NEW |