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

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

Issue 9809011: GData save package support with MHTML. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add comments and TODOs Created 8 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/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 30 matching lines...) Expand all
41 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
42 42
43 #if !defined(OS_ANDROID) 43 #if !defined(OS_ANDROID)
44 #include "chrome/browser/ui/browser.h" 44 #include "chrome/browser/ui/browser.h"
45 #include "chrome/browser/ui/browser_list.h" 45 #include "chrome/browser/ui/browser_list.h"
46 #endif 46 #endif
47 47
48 #if defined(OS_CHROMEOS) 48 #if defined(OS_CHROMEOS)
49 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 49 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
50 #include "chrome/browser/download/download_file_picker_chromeos.h" 50 #include "chrome/browser/download/download_file_picker_chromeos.h"
51 #include "chrome/browser/download/save_package_file_picker_chromeos.h"
51 #endif 52 #endif
52 53
53 using content::BrowserThread; 54 using content::BrowserThread;
54 using content::DownloadId; 55 using content::DownloadId;
55 using content::DownloadItem; 56 using content::DownloadItem;
56 using content::DownloadManager; 57 using content::DownloadManager;
57 using content::WebContents; 58 using content::WebContents;
58 using safe_browsing::DownloadProtectionService; 59 using safe_browsing::DownloadProtectionService;
59 60
60 namespace { 61 namespace {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 *download_save_dir = prefs->GetFilePath(prefs::kDownloadDefaultDirectory); 311 *download_save_dir = prefs->GetFilePath(prefs::kDownloadDefaultDirectory);
311 } 312 }
312 313
313 void ChromeDownloadManagerDelegate::ChooseSavePath( 314 void ChromeDownloadManagerDelegate::ChooseSavePath(
314 WebContents* web_contents, 315 WebContents* web_contents,
315 const FilePath& suggested_path, 316 const FilePath& suggested_path,
316 const FilePath::StringType& default_extension, 317 const FilePath::StringType& default_extension,
317 bool can_save_as_complete, 318 bool can_save_as_complete,
318 content::SaveFilePathPickedCallback callback) { 319 content::SaveFilePathPickedCallback callback) {
319 // Deletes itself. 320 // Deletes itself.
320 new SavePackageFilePicker( 321 #if defined(OS_CHROMEOS)
321 web_contents, suggested_path, default_extension, can_save_as_complete, 322 // Note that we're ignoring the callback here. TODO(achuith): Fix this.
Randy Smith (Not in Mondays) 2012/03/27 17:15:46 A little bit more information. Maybe "... ignorin
322 download_prefs_.get(), callback); 323 new SavePackageFilePickerChromeOS(web_contents, suggested_path);
324 #else
325 new SavePackageFilePicker(web_contents, suggested_path, default_extension,
326 can_save_as_complete, download_prefs_.get(), callback);
327 #endif
323 } 328 }
324 329
325 #if defined(ENABLE_SAFE_BROWSING) 330 #if defined(ENABLE_SAFE_BROWSING)
326 DownloadProtectionService* 331 DownloadProtectionService*
327 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { 332 ChromeDownloadManagerDelegate::GetDownloadProtectionService() {
328 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); 333 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service();
329 if (sb_service && sb_service->download_protection_service() && 334 if (sb_service && sb_service->download_protection_service() &&
330 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { 335 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) {
331 return sb_service->download_protection_service(); 336 return sb_service->download_protection_service();
332 } 337 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 int32 download_id, int64 db_handle) { 639 int32 download_id, int64 db_handle) {
635 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 640 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
636 // call this function with an invalid |db_handle|. For instance, this can 641 // call this function with an invalid |db_handle|. For instance, this can
637 // happen when the history database is offline. We cannot have multiple 642 // happen when the history database is offline. We cannot have multiple
638 // DownloadItems with the same invalid db_handle, so we need to assign a 643 // DownloadItems with the same invalid db_handle, so we need to assign a
639 // unique |db_handle| here. 644 // unique |db_handle| here.
640 if (db_handle == DownloadItem::kUninitializedHandle) 645 if (db_handle == DownloadItem::kUninitializedHandle)
641 db_handle = download_history_->GetNextFakeDbHandle(); 646 db_handle = download_history_->GetNextFakeDbHandle();
642 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 647 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
643 } 648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698