| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 const offline_pages::MultipleOfflinePageItemResult& pages) { | 135 const offline_pages::MultipleOfflinePageItemResult& pages) { |
| 136 base::ListValue results; | 136 base::ListValue results; |
| 137 | 137 |
| 138 for (const auto& page : pages) { | 138 for (const auto& page : pages) { |
| 139 base::DictionaryValue* offline_page = new base::DictionaryValue(); | 139 base::DictionaryValue* offline_page = new base::DictionaryValue(); |
| 140 results.Append(offline_page); | 140 results.Append(offline_page); |
| 141 offline_page->SetString("onlineUrl", page.url.spec()); | 141 offline_page->SetString("onlineUrl", page.url.spec()); |
| 142 offline_page->SetString("namespace", page.client_id.name_space); | 142 offline_page->SetString("namespace", page.client_id.name_space); |
| 143 offline_page->SetDouble("size", page.file_size); | 143 offline_page->SetDouble("size", page.file_size); |
| 144 offline_page->SetString("id", std::to_string(page.offline_id)); | 144 offline_page->SetString("id", std::to_string(page.offline_id)); |
| 145 offline_page->SetString("filePath", page.GetOfflineURL().spec()); | 145 offline_page->SetString("filePath", page.file_path.MaybeAsASCII()); |
| 146 offline_page->SetDouble("creationTime", page.creation_time.ToJsTime()); | 146 offline_page->SetDouble("creationTime", page.creation_time.ToJsTime()); |
| 147 offline_page->SetDouble("lastAccessTime", page.last_access_time.ToJsTime()); | 147 offline_page->SetDouble("lastAccessTime", page.last_access_time.ToJsTime()); |
| 148 offline_page->SetInteger("accessCount", page.access_count); | 148 offline_page->SetInteger("accessCount", page.access_count); |
| 149 offline_page->SetString("isExpired", page.IsExpired() ? "Yes" : "No"); | 149 offline_page->SetString("isExpired", page.IsExpired() ? "Yes" : "No"); |
| 150 } | 150 } |
| 151 ResolveJavascriptCallback(base::StringValue(callback_id), results); | 151 ResolveJavascriptCallback(base::StringValue(callback_id), results); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void OfflineInternalsUIMessageHandler::HandleRequestQueueCallback( | 154 void OfflineInternalsUIMessageHandler::HandleRequestQueueCallback( |
| 155 std::string callback_id, | 155 std::string callback_id, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 // Get the offline page model associated with this web ui. | 341 // Get the offline page model associated with this web ui. |
| 342 Profile* profile = Profile::FromWebUI(web_ui()); | 342 Profile* profile = Profile::FromWebUI(web_ui()); |
| 343 offline_page_model_ = | 343 offline_page_model_ = |
| 344 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); | 344 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); |
| 345 request_coordinator_ = | 345 request_coordinator_ = |
| 346 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); | 346 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace offline_internals | 349 } // namespace offline_internals |
| OLD | NEW |