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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/extensions/api/downloads/downloads_api.h" 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cctype> 8 #include <cctype>
9 #include <iterator> 9 #include <iterator>
10 #include <set> 10 #include <set>
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 } 1038 }
1039 1039
1040 void DownloadsDownloadFunction::OnStarted( 1040 void DownloadsDownloadFunction::OnStarted(
1041 const base::FilePath& creator_suggested_filename, 1041 const base::FilePath& creator_suggested_filename,
1042 downloads::FilenameConflictAction creator_conflict_action, 1042 downloads::FilenameConflictAction creator_conflict_action,
1043 DownloadItem* item, 1043 DownloadItem* item,
1044 content::DownloadInterruptReason interrupt_reason) { 1044 content::DownloadInterruptReason interrupt_reason) {
1045 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1045 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1046 VLOG(1) << __FUNCTION__ << " " << item << " " << interrupt_reason; 1046 VLOG(1) << __FUNCTION__ << " " << item << " " << interrupt_reason;
1047 if (item) { 1047 if (item) {
1048 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason);
1049 SetResult(new base::FundamentalValue(static_cast<int>(item->GetId()))); 1048 SetResult(new base::FundamentalValue(static_cast<int>(item->GetId())));
1050 if (!creator_suggested_filename.empty()) { 1049 if (!creator_suggested_filename.empty()) {
1051 ExtensionDownloadsEventRouterData* data = 1050 ExtensionDownloadsEventRouterData* data =
1052 ExtensionDownloadsEventRouterData::Get(item); 1051 ExtensionDownloadsEventRouterData::Get(item);
1053 if (!data) { 1052 if (!data) {
1054 data = new ExtensionDownloadsEventRouterData( 1053 data = new ExtensionDownloadsEventRouterData(
1055 item, 1054 item,
1056 scoped_ptr<base::DictionaryValue>(new base::DictionaryValue())); 1055 scoped_ptr<base::DictionaryValue>(new base::DictionaryValue()));
1057 } 1056 }
1058 data->CreatorSuggestedFilename( 1057 data->CreatorSuggestedFilename(
1059 creator_suggested_filename, creator_conflict_action); 1058 creator_suggested_filename, creator_conflict_action);
1060 } 1059 }
1061 new DownloadedByExtension( 1060 new DownloadedByExtension(
1062 item, GetExtension()->id(), GetExtension()->name()); 1061 item, GetExtension()->id(), GetExtension()->name());
1063 item->UpdateObservers(); 1062 item->UpdateObservers();
1064 } else { 1063 } else {
1065 DCHECK_NE(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason);
1066 error_ = content::DownloadInterruptReasonToString(interrupt_reason); 1064 error_ = content::DownloadInterruptReasonToString(interrupt_reason);
1067 } 1065 }
1068 SendResponse(error_.empty()); 1066 SendResponse(error_.empty());
1069 } 1067 }
1070 1068
1071 DownloadsSearchFunction::DownloadsSearchFunction() {} 1069 DownloadsSearchFunction::DownloadsSearchFunction() {}
1072 1070
1073 DownloadsSearchFunction::~DownloadsSearchFunction() {} 1071 DownloadsSearchFunction::~DownloadsSearchFunction() {}
1074 1072
1075 bool DownloadsSearchFunction::RunImpl() { 1073 bool DownloadsSearchFunction::RunImpl() {
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 extensions::UnloadedExtensionInfo* unloaded = 1896 extensions::UnloadedExtensionInfo* unloaded =
1899 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); 1897 content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
1900 std::set<const extensions::Extension*>::iterator iter = 1898 std::set<const extensions::Extension*>::iterator iter =
1901 shelf_disabling_extensions_.find(unloaded->extension); 1899 shelf_disabling_extensions_.find(unloaded->extension);
1902 if (iter != shelf_disabling_extensions_.end()) 1900 if (iter != shelf_disabling_extensions_.end())
1903 shelf_disabling_extensions_.erase(iter); 1901 shelf_disabling_extensions_.erase(iter);
1904 break; 1902 break;
1905 } 1903 }
1906 } 1904 }
1907 } 1905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698