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

Side by Side Diff: chrome/browser/download/save_package_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/save_package_file_picker_chromeos.h" 5 #include "chrome/browser/download/save_package_file_picker_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/i18n/file_util_icu.h" 9 #include "base/i18n/file_util_icu.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 12 matching lines...) Expand all
23 // If false, we don't prompt the user as to where to save the file. This 23 // If false, we don't prompt the user as to where to save the file. This
24 // exists only for testing. 24 // exists only for testing.
25 bool g_should_prompt_for_filename = true; 25 bool g_should_prompt_for_filename = true;
26 26
27 // Trampoline callback between GetDriveTempDownloadPath() and |callback|. 27 // Trampoline callback between GetDriveTempDownloadPath() and |callback|.
28 void ContinueSettingUpDriveDownload( 28 void ContinueSettingUpDriveDownload(
29 const content::SavePackagePathPickedCallback& callback, 29 const content::SavePackagePathPickedCallback& callback,
30 const FilePath& drive_path, 30 const FilePath& drive_path,
31 const FilePath& drive_tmp_download_path) { 31 const FilePath& drive_tmp_download_path) {
32 callback.Run(drive_tmp_download_path, content::SAVE_PAGE_TYPE_AS_MHTML, 32 callback.Run(drive_tmp_download_path, content::SAVE_PAGE_TYPE_AS_MHTML,
33 base::Bind(&gdata::DriveDownloadObserver::SetDownloadParams, 33 base::Bind(&drive::DriveDownloadObserver::SetDownloadParams,
34 drive_path)); 34 drive_path));
35 } 35 }
36 36
37 } // anonymous namespace 37 } // anonymous namespace
38 38
39 SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS( 39 SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS(
40 content::WebContents* web_contents, 40 content::WebContents* web_contents,
41 const FilePath& suggested_path, 41 const FilePath& suggested_path,
42 const content::SavePackagePathPickedCallback& callback) 42 const content::SavePackagePathPickedCallback& callback)
43 : content::WebContentsObserver(web_contents), 43 : content::WebContentsObserver(web_contents),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (!web_contents()) { 85 if (!web_contents()) {
86 delete this; 86 delete this;
87 return; 87 return;
88 } 88 }
89 FilePath selected_path = selected_file_info.file_path; 89 FilePath selected_path = selected_file_info.file_path;
90 file_util::NormalizeFileNameEncoding(&selected_path); 90 file_util::NormalizeFileNameEncoding(&selected_path);
91 Profile* profile = Profile::FromBrowserContext( 91 Profile* profile = Profile::FromBrowserContext(
92 web_contents()->GetBrowserContext()); 92 web_contents()->GetBrowserContext());
93 DCHECK(profile); 93 DCHECK(profile);
94 94
95 if (gdata::util::IsUnderDriveMountPoint(selected_path)) { 95 if (drive::util::IsUnderDriveMountPoint(selected_path)) {
96 // Here's a map to the callback chain: 96 // Here's a map to the callback chain:
97 // GetDriveTempDownloadPath -> 97 // GetDriveTempDownloadPath ->
98 // ContinueSettingUpDriveDownload -> 98 // ContinueSettingUpDriveDownload ->
99 // callback_ = SavePackage::OnPathPicked -> 99 // callback_ = SavePackage::OnPathPicked ->
100 // download_created_callback = OnSavePackageDownloadCreated 100 // download_created_callback = OnSavePackageDownloadCreated
101 gdata::DriveDownloadObserver::SubstituteDriveDownloadPath( 101 drive::DriveDownloadObserver::SubstituteDriveDownloadPath(
102 profile, selected_path, NULL, 102 profile, selected_path, NULL,
103 base::Bind(&ContinueSettingUpDriveDownload, callback_, selected_path)); 103 base::Bind(&ContinueSettingUpDriveDownload, callback_, selected_path));
104 } else { 104 } else {
105 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML, 105 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML,
106 content::SavePackageDownloadCreatedCallback()); 106 content::SavePackageDownloadCreatedCallback());
107 } 107 }
108 delete this; 108 delete this;
109 } 109 }
110 110
111 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) { 111 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) {
112 delete this; 112 delete this;
113 } 113 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_prefs.cc ('k') | chrome/browser/extensions/webstore_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698