| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |