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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.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/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } else if (!state->is_complete()) { 319 } else if (!state->is_complete()) {
320 // Don't complete the download until we have an answer. 320 // Don't complete the download until we have an answer.
321 state->set_callback(internal_complete_callback); 321 state->set_callback(internal_complete_callback);
322 return false; 322 return false;
323 } 323 }
324 #endif 324 #endif
325 325
326 #if defined(OS_CHROMEOS) 326 #if defined(OS_CHROMEOS)
327 // If there's a Drive upload associated with this download, we wait until that 327 // If there's a Drive upload associated with this download, we wait until that
328 // is complete before allowing the download item to complete. 328 // is complete before allowing the download item to complete.
329 if (!gdata::DriveDownloadObserver::IsReadyToComplete( 329 if (!drive::DriveDownloadObserver::IsReadyToComplete(
330 item, internal_complete_callback)) 330 item, internal_complete_callback))
331 return false; 331 return false;
332 #endif 332 #endif
333 return true; 333 return true;
334 } 334 }
335 335
336 // ShouldCompleteDownloadInternal() will never be called directly by a user, it 336 // ShouldCompleteDownloadInternal() will never be called directly by a user, it
337 // will only be called asynchronously, so it should run 337 // will only be called asynchronously, so it should run
338 // |user_complete_callback|. ShouldCompleteDownload() will only be called 338 // |user_complete_callback|. ShouldCompleteDownload() will only be called
339 // directly by a user, so it does not need to run |user_complete_callback| 339 // directly by a user, so it does not need to run |user_complete_callback|
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 549
550 // Get the directory from preference. 550 // Get the directory from preference.
551 *website_save_dir = prefs->GetFilePath(prefs::kSaveFileDefaultDirectory); 551 *website_save_dir = prefs->GetFilePath(prefs::kSaveFileDefaultDirectory);
552 DCHECK(!website_save_dir->empty()); 552 DCHECK(!website_save_dir->empty());
553 553
554 *download_save_dir = prefs->GetFilePath(prefs::kDownloadDefaultDirectory); 554 *download_save_dir = prefs->GetFilePath(prefs::kDownloadDefaultDirectory);
555 555
556 *skip_dir_check = false; 556 *skip_dir_check = false;
557 #if defined(OS_CHROMEOS) 557 #if defined(OS_CHROMEOS)
558 *skip_dir_check = gdata::util::IsUnderDriveMountPoint(*website_save_dir); 558 *skip_dir_check = drive::util::IsUnderDriveMountPoint(*website_save_dir);
559 #endif 559 #endif
560 } 560 }
561 561
562 void ChromeDownloadManagerDelegate::ChooseSavePath( 562 void ChromeDownloadManagerDelegate::ChooseSavePath(
563 WebContents* web_contents, 563 WebContents* web_contents,
564 const FilePath& suggested_path, 564 const FilePath& suggested_path,
565 const FilePath::StringType& default_extension, 565 const FilePath::StringType& default_extension,
566 bool can_save_as_complete, 566 bool can_save_as_complete,
567 const content::SavePackagePathPickedCallback& callback) { 567 const content::SavePackagePathPickedCallback& callback) {
568 // Deletes itself. 568 // Deletes itself.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 if (service->IsSupportedDownload(info)) 795 if (service->IsSupportedDownload(info))
796 danger_type = content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT; 796 danger_type = content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT;
797 } 797 }
798 #endif 798 #endif
799 } else { 799 } else {
800 // Currently we only expect this case. 800 // Currently we only expect this case.
801 DCHECK_EQ(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL, danger_type); 801 DCHECK_EQ(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL, danger_type);
802 } 802 }
803 803
804 #if defined (OS_CHROMEOS) 804 #if defined (OS_CHROMEOS)
805 gdata::DriveDownloadObserver::SubstituteDriveDownloadPath( 805 drive::DriveDownloadObserver::SubstituteDriveDownloadPath(
806 profile_, suggested_path, download, 806 profile_, suggested_path, download,
807 base::Bind( 807 base::Bind(
808 &ChromeDownloadManagerDelegate::SubstituteDriveDownloadPathCallback, 808 &ChromeDownloadManagerDelegate::SubstituteDriveDownloadPathCallback,
809 this, download->GetId(), callback, should_prompt, is_forced_path, 809 this, download->GetId(), callback, should_prompt, is_forced_path,
810 danger_type)); 810 danger_type));
811 #else 811 #else
812 GetReservedPath( 812 GetReservedPath(
813 *download, suggested_path, download_prefs_->DownloadPath(), 813 *download, suggested_path, download_prefs_->DownloadPath(),
814 !is_forced_path, 814 !is_forced_path,
815 base::Bind(&ChromeDownloadManagerDelegate::OnPathReservationAvailable, 815 base::Bind(&ChromeDownloadManagerDelegate::OnPathReservationAvailable,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 int32 download_id, int64 db_handle) { 904 int32 download_id, int64 db_handle) {
905 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 905 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
906 // call this function with an invalid |db_handle|. For instance, this can 906 // call this function with an invalid |db_handle|. For instance, this can
907 // happen when the history database is offline. We cannot have multiple 907 // happen when the history database is offline. We cannot have multiple
908 // DownloadItems with the same invalid db_handle, so we need to assign a 908 // DownloadItems with the same invalid db_handle, so we need to assign a
909 // unique |db_handle| here. 909 // unique |db_handle| here.
910 if (db_handle == DownloadItem::kUninitializedHandle) 910 if (db_handle == DownloadItem::kUninitializedHandle)
911 db_handle = download_history_->GetNextFakeDbHandle(); 911 db_handle = download_history_->GetNextFakeDbHandle();
912 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 912 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
913 } 913 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/ash_system_tray_delegate.cc ('k') | chrome/browser/download/download_file_picker_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698