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

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

Issue 12850002: Move download filename determintion into a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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_chromeos.h" 5 #include "chrome/browser/download/download_file_picker_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/file_util_icu.h" 8 #include "base/i18n/file_util_icu.h"
9 #include "chrome/browser/chromeos/drive/drive_download_handler.h" 9 #include "chrome/browser/chromeos/drive/drive_download_handler.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/browser/download_item.h" 11 #include "content/public/browser/download_item.h"
12 #include "content/public/browser/download_manager.h" 12 #include "content/public/browser/download_manager.h"
13 #include "ui/shell_dialogs/selected_file_info.h" 13 #include "ui/shell_dialogs/selected_file_info.h"
14 14
15 using content::DownloadItem; 15 using content::DownloadItem;
16 using content::DownloadManager; 16 using content::DownloadManager;
17 17
18 DownloadFilePickerChromeOS::DownloadFilePickerChromeOS() { 18 DownloadFilePickerChromeOS::DownloadFilePickerChromeOS(
19 DownloadItem* item,
20 const base::FilePath& suggested_path,
21 const FileSelectedCallback& callback)
22 : DownloadFilePicker(item, suggested_path, callback) {
19 } 23 }
20 24
21 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() { 25 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() {
22 } 26 }
23 27
24 void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item, 28 void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item,
25 const base::FilePath& path) { 29 const base::FilePath& path) {
26 // For Drive downloads, we should pass the drive path instead of the temporary 30 // For Drive downloads, we should pass the drive path instead of the temporary
27 // file path. 31 // file path.
28 Profile* profile = 32 Profile* profile =
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (download_manager_) { 64 if (download_manager_) {
61 Profile* profile = 65 Profile* profile =
62 Profile::FromBrowserContext(download_manager_->GetBrowserContext()); 66 Profile::FromBrowserContext(download_manager_->GetBrowserContext());
63 drive::DriveDownloadHandler* drive_download_handler = 67 drive::DriveDownloadHandler* drive_download_handler =
64 drive::DriveDownloadHandler::GetForProfile(profile); 68 drive::DriveDownloadHandler::GetForProfile(profile);
65 if (drive_download_handler) { 69 if (drive_download_handler) {
66 DownloadItem* download = download_manager_->GetDownload(download_id_); 70 DownloadItem* download = download_manager_->GetDownload(download_id_);
67 drive_download_handler->SubstituteDriveDownloadPath( 71 drive_download_handler->SubstituteDriveDownloadPath(
68 path, download, 72 path, download,
69 base::Bind(&DownloadFilePickerChromeOS::OnFileSelected, 73 base::Bind(&DownloadFilePickerChromeOS::OnFileSelected,
70 base::Unretained(this))); 74 base::Unretained(this), path));
71 } else { 75 } else {
72 OnFileSelected(path); 76 OnFileSelected(path, path);
73 } 77 }
74 } else { 78 } else {
75 OnFileSelected(base::FilePath()); 79 OnFileSelected(baes::FilePath(), base::FilePath());
benjhayden 2013/04/09 15:46:32 s/baes/base/
76 } 80 }
77 // The OnFileSelected() call deletes |this| 81 // The OnFileSelected() call deletes |this|
78 } 82 }
83
84 // static
85 void DownloadFilePicker::ShowFilePicker(DownloadItem* item,
86 const base::FilePath& suggested_path,
87 const FileSelectedCallback& callback) {
88 new DownloadFilePickerChromeOS(item, suggested_path, callback);
89 // DownloadFilePickerChromeOS deletes itself.
90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698