| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/offline/offline_internals_ui_message_handler.h
" | 5 #include "chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.h
" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const offline_pages::MultipleOfflinePageItemResult& pages) { | 99 const offline_pages::MultipleOfflinePageItemResult& pages) { |
| 100 base::ListValue results; | 100 base::ListValue results; |
| 101 | 101 |
| 102 for (const auto& page : pages) { | 102 for (const auto& page : pages) { |
| 103 base::DictionaryValue* offline_page = new base::DictionaryValue(); | 103 base::DictionaryValue* offline_page = new base::DictionaryValue(); |
| 104 results.Append(offline_page); | 104 results.Append(offline_page); |
| 105 offline_page->SetString("onlineUrl", page.url.spec()); | 105 offline_page->SetString("onlineUrl", page.url.spec()); |
| 106 offline_page->SetString("namespace", page.client_id.name_space); | 106 offline_page->SetString("namespace", page.client_id.name_space); |
| 107 offline_page->SetDouble("size", page.file_size); | 107 offline_page->SetDouble("size", page.file_size); |
| 108 offline_page->SetString("id", std::to_string(page.offline_id)); | 108 offline_page->SetString("id", std::to_string(page.offline_id)); |
| 109 offline_page->SetString("filePath", page.GetOfflineURL().spec()); | 109 offline_page->SetString("filePath", page.file_path.MaybeAsASCII()); |
| 110 offline_page->SetDouble("creationTime", page.creation_time.ToJsTime()); | 110 offline_page->SetDouble("creationTime", page.creation_time.ToJsTime()); |
| 111 offline_page->SetDouble("lastAccessTime", page.last_access_time.ToJsTime()); | 111 offline_page->SetDouble("lastAccessTime", page.last_access_time.ToJsTime()); |
| 112 offline_page->SetInteger("accessCount", page.access_count); | 112 offline_page->SetInteger("accessCount", page.access_count); |
| 113 offline_page->SetString("isExpired", page.IsExpired() ? "Yes" : "No"); | 113 offline_page->SetString("isExpired", page.IsExpired() ? "Yes" : "No"); |
| 114 } | 114 } |
| 115 ResolveJavascriptCallback(base::StringValue(callback_id), results); | 115 ResolveJavascriptCallback(base::StringValue(callback_id), results); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void OfflineInternalsUIMessageHandler::HandleRequestQueueCallback( | 118 void OfflineInternalsUIMessageHandler::HandleRequestQueueCallback( |
| 119 std::string callback_id, | 119 std::string callback_id, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 // Get the offline page model associated with this web ui. | 291 // Get the offline page model associated with this web ui. |
| 292 Profile* profile = Profile::FromWebUI(web_ui()); | 292 Profile* profile = Profile::FromWebUI(web_ui()); |
| 293 offline_page_model_ = | 293 offline_page_model_ = |
| 294 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); | 294 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); |
| 295 request_coordinator_ = | 295 request_coordinator_ = |
| 296 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); | 296 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); |
| 297 } | 297 } |
| 298 | 298 |
| 299 } // namespace offline_internals | 299 } // namespace offline_internals |
| OLD | NEW |