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

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

Issue 11106007: drive: Rename 'gdata' namespace to 'drive' in chrome/browser/chromeos/drive (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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_observer.h" 9 #include "chrome/browser/chromeos/drive/drive_download_observer.h"
10 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 10 #include "chrome/browser/chromeos/drive/drive_file_system_util.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/base/dialogs/selected_file_info.h" 13 #include "ui/base/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 } 19 }
20 20
21 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() { 21 DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() {
22 } 22 }
23 23
24 void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item, 24 void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item,
25 const FilePath& path) { 25 const FilePath& path) {
26 // For Drive downloads, |path| is the virtual gdata path instead of the 26 // For Drive downloads, |path| is the virtual gdata path instead of the
27 // temporary local one. 27 // temporary local one.
28 if (gdata::DriveDownloadObserver::IsDriveDownload(item)) { 28 if (drive::DriveDownloadObserver::IsDriveDownload(item)) {
29 set_suggested_path(gdata::util::GetSpecialRemoteRootPath().Append( 29 set_suggested_path(drive::util::GetSpecialRemoteRootPath().Append(
30 gdata::DriveDownloadObserver::GetDrivePath(item))); 30 drive::DriveDownloadObserver::GetDrivePath(item)));
31 } else { 31 } else {
32 DownloadFilePicker::InitSuggestedPath(item, path); 32 DownloadFilePicker::InitSuggestedPath(item, path);
33 } 33 }
34 } 34 }
35 35
36 void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path, 36 void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path,
37 int index, 37 int index,
38 void* params) { 38 void* params) {
39 FileSelectedWithExtraInfo( 39 FileSelectedWithExtraInfo(
40 ui::SelectedFileInfo(selected_path, selected_path), 40 ui::SelectedFileInfo(selected_path, selected_path),
41 index, 41 index,
42 params); 42 params);
43 } 43 }
44 44
45 void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo( 45 void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo(
46 const ui::SelectedFileInfo& file_info, 46 const ui::SelectedFileInfo& file_info,
47 int index, 47 int index,
48 void* params) { 48 void* params) {
49 FilePath path = file_info.file_path; 49 FilePath path = file_info.file_path;
50 file_util::NormalizeFileNameEncoding(&path); 50 file_util::NormalizeFileNameEncoding(&path);
51 51
52 // Need to do this before we substitute with a temporary path. Otherwise we 52 // Need to do this before we substitute with a temporary path. Otherwise we
53 // won't be able to detect path changes. 53 // won't be able to detect path changes.
54 RecordFileSelected(path); 54 RecordFileSelected(path);
55 55
56 if (download_manager_) { 56 if (download_manager_) {
57 DownloadItem* download = download_manager_->GetDownload(download_id_); 57 DownloadItem* download = download_manager_->GetDownload(download_id_);
58 gdata::DriveDownloadObserver::SubstituteDriveDownloadPath( 58 drive::DriveDownloadObserver::SubstituteDriveDownloadPath(
59 NULL, path, download, 59 NULL, path, download,
60 base::Bind(&DownloadFilePickerChromeOS::OnFileSelected, 60 base::Bind(&DownloadFilePickerChromeOS::OnFileSelected,
61 base::Unretained(this))); 61 base::Unretained(this)));
62 } else { 62 } else {
63 OnFileSelected(FilePath()); 63 OnFileSelected(FilePath());
64 } 64 }
65 // The OnFileSelected() call deletes |this| 65 // The OnFileSelected() call deletes |this|
66 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_item_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698