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_internals_ui.h" | 5 #include "chrome/browser/ui/webui/offline_internals_ui.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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 results.Append(offline_page); | 195 results.Append(offline_page); |
196 offline_page->SetString("onlineUrl", page.url.spec()); | 196 offline_page->SetString("onlineUrl", page.url.spec()); |
197 offline_page->SetString("namespace", page.client_id.name_space); | 197 offline_page->SetString("namespace", page.client_id.name_space); |
198 offline_page->SetDouble("size", page.file_size); | 198 offline_page->SetDouble("size", page.file_size); |
199 offline_page->SetString("id", std::to_string(page.offline_id)); | 199 offline_page->SetString("id", std::to_string(page.offline_id)); |
200 offline_page->SetString("filePath", page.file_path.value()); | 200 offline_page->SetString("filePath", page.file_path.value()); |
201 offline_page->SetDouble("creationTime", page.creation_time.ToJsTime()); | 201 offline_page->SetDouble("creationTime", page.creation_time.ToJsTime()); |
202 offline_page->SetDouble("lastAccessTime", | 202 offline_page->SetDouble("lastAccessTime", |
203 page.last_access_time.ToJsTime()); | 203 page.last_access_time.ToJsTime()); |
204 offline_page->SetInteger("accessCount", page.access_count); | 204 offline_page->SetInteger("accessCount", page.access_count); |
| 205 offline_page->SetString("isExpired", page.IsExpired() ? "Yes" : "No"); |
205 } | 206 } |
206 ResolveJavascriptCallback(base::StringValue(callback_id), results); | 207 ResolveJavascriptCallback(base::StringValue(callback_id), results); |
207 } | 208 } |
208 | 209 |
209 void OfflineInternalsUIMessageHandler::HandleRequestQueueCallback( | 210 void OfflineInternalsUIMessageHandler::HandleRequestQueueCallback( |
210 std::string callback_id, | 211 std::string callback_id, |
211 offline_pages::RequestQueue::GetRequestsResult result, | 212 offline_pages::RequestQueue::GetRequestsResult result, |
212 const std::vector<offline_pages::SavePageRequest>& requests) { | 213 const std::vector<offline_pages::SavePageRequest>& requests) { |
213 base::ListValue save_page_requests; | 214 base::ListValue save_page_requests; |
214 if (result == offline_pages::RequestQueue::GetRequestsResult::SUCCESS) { | 215 if (result == offline_pages::RequestQueue::GetRequestsResult::SUCCESS) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 html_source->AddResourcePath("offline_internals_browser_proxy.js", | 367 html_source->AddResourcePath("offline_internals_browser_proxy.js", |
367 IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS); | 368 IDR_OFFLINE_INTERNALS_BROWSER_PROXY_JS); |
368 html_source->SetDefaultResource(IDR_OFFLINE_INTERNALS_HTML); | 369 html_source->SetDefaultResource(IDR_OFFLINE_INTERNALS_HTML); |
369 | 370 |
370 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); | 371 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); |
371 | 372 |
372 web_ui->AddMessageHandler(new OfflineInternalsUIMessageHandler()); | 373 web_ui->AddMessageHandler(new OfflineInternalsUIMessageHandler()); |
373 } | 374 } |
374 | 375 |
375 OfflineInternalsUI::~OfflineInternalsUI() {} | 376 OfflineInternalsUI::~OfflineInternalsUI() {} |
OLD | NEW |