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

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 257983002: Move downloads API to extensions namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile error for unittest Created 6 years, 7 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
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/downloads_dom_handler.h" 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 download_item->GetStartTime(), NULL)); 128 download_item->GetStartTime(), NULL));
129 file_value->SetString( 129 file_value->SetString(
130 "date_string", base::TimeFormatShortDate(download_item->GetStartTime())); 130 "date_string", base::TimeFormatShortDate(download_item->GetStartTime()));
131 file_value->SetInteger("id", download_item->GetId()); 131 file_value->SetInteger("id", download_item->GetId());
132 132
133 base::FilePath download_path(download_item->GetTargetFilePath()); 133 base::FilePath download_path(download_item->GetTargetFilePath());
134 file_value->Set("file_path", base::CreateFilePathValue(download_path)); 134 file_value->Set("file_path", base::CreateFilePathValue(download_path));
135 file_value->SetString("file_url", 135 file_value->SetString("file_url",
136 net::FilePathToFileURL(download_path).spec()); 136 net::FilePathToFileURL(download_path).spec());
137 137
138 DownloadedByExtension* by_ext = DownloadedByExtension::Get(download_item); 138 extensions::DownloadedByExtension* by_ext =
139 extensions::DownloadedByExtension::Get(download_item);
139 if (by_ext) { 140 if (by_ext) {
140 file_value->SetString("by_ext_id", by_ext->id()); 141 file_value->SetString("by_ext_id", by_ext->id());
141 file_value->SetString("by_ext_name", by_ext->name()); 142 file_value->SetString("by_ext_name", by_ext->name());
142 // Lookup the extension's current name() in case the user changed their 143 // Lookup the extension's current name() in case the user changed their
143 // language. This won't work if the extension was uninstalled, so the name 144 // language. This won't work if the extension was uninstalled, so the name
144 // might be the wrong language. 145 // might be the wrong language.
145 bool include_disabled = true; 146 bool include_disabled = true;
146 const extensions::Extension* extension = extensions::ExtensionSystem::Get( 147 const extensions::Extension* extension = extensions::ExtensionSystem::Get(
147 Profile::FromBrowserContext(download_item->GetBrowserContext()))-> 148 Profile::FromBrowserContext(download_item->GetBrowserContext()))->
148 extension_service()->GetExtensionById(by_ext->id(), include_disabled); 149 extension_service()->GetExtensionById(by_ext->id(), include_disabled);
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 576 }
576 577
577 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) { 578 void DownloadsDOMHandler::CallDownloadsList(const base::ListValue& downloads) {
578 web_ui()->CallJavascriptFunction("downloadsList", downloads); 579 web_ui()->CallJavascriptFunction("downloadsList", downloads);
579 } 580 }
580 581
581 void DownloadsDOMHandler::CallDownloadUpdated( 582 void DownloadsDOMHandler::CallDownloadUpdated(
582 const base::ListValue& download_item) { 583 const base::ListValue& download_item) {
583 web_ui()->CallJavascriptFunction("downloadUpdated", download_item); 584 web_ui()->CallJavascriptFunction("downloadUpdated", download_item);
584 } 585 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698