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

Unified Diff: chrome/browser/download/download_extension_api.cc

Issue 8503018: Split DownloadItem into an ABC, an Impl, and a Mock. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_crx_util.cc ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_extension_api.cc
diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc
index 9629c638d626abc7e1e9a05164cb00f5b5f9197a..ecc78c9ff5b0c519ebdf2d3c9623253456e020f2 100644
--- a/chrome/browser/download/download_extension_api.cc
+++ b/chrome/browser/download/download_extension_api.cc
@@ -452,24 +452,24 @@ void DownloadsDragFunction::RunInternal() {
namespace {
base::DictionaryValue* DownloadItemToJSON(DownloadItem* item) {
base::DictionaryValue* json = new base::DictionaryValue();
- json->SetInteger(kIdKey, item->id());
- json->SetString(kUrlKey, item->original_url().spec());
- json->SetString(kFilenameKey, item->full_path().LossyDisplayName());
+ json->SetInteger(kIdKey, item->GetId());
+ json->SetString(kUrlKey, item->GetOriginalUrl().spec());
+ json->SetString(kFilenameKey, item->GetFullPath().LossyDisplayName());
json->SetString(kDangerKey, DangerString(item->GetDangerType()));
json->SetBoolean(kDangerAcceptedKey,
- item->safety_state() == DownloadItem::DANGEROUS_BUT_VALIDATED);
- json->SetString(kStateKey, StateString(item->state()));
- json->SetBoolean(kPausedKey, item->is_paused());
- json->SetString(kMimeKey, item->mime_type());
+ item->GetSafetyState() == DownloadItem::DANGEROUS_BUT_VALIDATED);
+ json->SetString(kStateKey, StateString(item->GetState()));
+ json->SetBoolean(kPausedKey, item->IsPaused());
+ json->SetString(kMimeKey, item->GetMimeType());
json->SetInteger(kStartTimeKey,
- (item->start_time() - base::Time::UnixEpoch()).InMilliseconds());
- json->SetInteger(kBytesReceivedKey, item->received_bytes());
- json->SetInteger(kTotalBytesKey, item->total_bytes());
- if (item->state() == DownloadItem::INTERRUPTED)
- json->SetInteger(kErrorKey, static_cast<int>(item->last_reason()));
+ (item->GetStartTime() - base::Time::UnixEpoch()).InMilliseconds());
+ json->SetInteger(kBytesReceivedKey, item->GetReceivedBytes());
+ json->SetInteger(kTotalBytesKey, item->GetTotalBytes());
+ if (item->GetState() == DownloadItem::INTERRUPTED)
+ json->SetInteger(kErrorKey, static_cast<int>(item->GetLastReason()));
// TODO(benjhayden): Implement endTime and fileSize.
// json->SetInteger(kEndTimeKey, -1);
- json->SetInteger(kFileSizeKey, item->total_bytes());
+ json->SetInteger(kFileSizeKey, item->GetTotalBytes());
return json;
}
} // anonymous namespace
@@ -504,7 +504,7 @@ void ExtensionDownloadsEventRouter::ModelChanged() {
current_vec.begin();
iter != current_vec.end(); ++iter) {
DownloadItem* item = *iter;
- int item_id = item->id();
+ int item_id = item->GetId();
// TODO(benjhayden): Remove the following line when every item's id >= 0,
// which will allow firing onErased events for items from the history.
if (item_id < 0) continue;
« no previous file with comments | « chrome/browser/download/download_crx_util.cc ('k') | chrome/browser/download/download_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698