OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/ui/webui/settings/downloads_handler.h" | 5 #include "chrome/browser/ui/webui/settings/downloads_handler.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/download/download_prefs.h" | 10 #include "chrome/browser/download/download_prefs.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 void DownloadsHandler::HandleSelectDownloadLocation( | 42 void DownloadsHandler::HandleSelectDownloadLocation( |
43 const base::ListValue* args) { | 43 const base::ListValue* args) { |
44 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 44 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
45 select_folder_dialog_ = ui::SelectFileDialog::Create( | 45 select_folder_dialog_ = ui::SelectFileDialog::Create( |
46 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); | 46 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); |
47 ui::SelectFileDialog::FileTypeInfo info; | 47 ui::SelectFileDialog::FileTypeInfo info; |
48 info.support_drive = true; | 48 info.support_drive = true; |
49 select_folder_dialog_->SelectFile( | 49 select_folder_dialog_->SelectFile( |
50 ui::SelectFileDialog::SELECT_FOLDER, | 50 ui::SelectFileDialog::SELECT_FOLDER, |
51 l10n_util::GetStringUTF16(IDS_SETTINGS_DOWNLOADS_LOCATION_LABEL), | 51 l10n_util::GetStringUTF16(IDS_SETTINGS_DOWNLOAD_LOCATION), |
52 pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), &info, 0, | 52 pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), &info, 0, |
53 base::FilePath::StringType(), | 53 base::FilePath::StringType(), |
54 web_ui()->GetWebContents()->GetTopLevelNativeWindow(), NULL); | 54 web_ui()->GetWebContents()->GetTopLevelNativeWindow(), NULL); |
55 } | 55 } |
56 | 56 |
57 void DownloadsHandler::FileSelected(const base::FilePath& path, | 57 void DownloadsHandler::FileSelected(const base::FilePath& path, |
58 int index, | 58 int index, |
59 void* params) { | 59 void* params) { |
60 content::RecordAction(UserMetricsAction("Options_SetDownloadDirectory")); | 60 content::RecordAction(UserMetricsAction("Options_SetDownloadDirectory")); |
61 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 61 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
62 pref_service->SetFilePath(prefs::kDownloadDefaultDirectory, path); | 62 pref_service->SetFilePath(prefs::kDownloadDefaultDirectory, path); |
63 pref_service->SetFilePath(prefs::kSaveFileDefaultDirectory, path); | 63 pref_service->SetFilePath(prefs::kSaveFileDefaultDirectory, path); |
64 } | 64 } |
65 | 65 |
66 } // namespace settings | 66 } // namespace settings |
OLD | NEW |