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

Side by Side Diff: chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc

Issue 2262423002: Use a vector of smart pointers for callback return type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Logical merge fixes Created 4 years, 4 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
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
120 offline_pages::RequestQueue::GetRequestsResult result, 120 offline_pages::RequestQueue::GetRequestsResult result,
121 const std::vector<offline_pages::SavePageRequest>& requests) { 121 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests) {
122 base::ListValue save_page_requests; 122 base::ListValue save_page_requests;
123 if (result == offline_pages::RequestQueue::GetRequestsResult::SUCCESS) { 123 if (result == offline_pages::RequestQueue::GetRequestsResult::SUCCESS) {
124 for (const auto& request : requests) { 124 for (const auto& request : requests) {
125 base::DictionaryValue* save_page_request = new base::DictionaryValue(); 125 base::DictionaryValue* save_page_request = new base::DictionaryValue();
126 save_page_requests.Append(save_page_request); 126 save_page_requests.Append(save_page_request);
127 save_page_request->SetString("onlineUrl", request.url().spec()); 127 save_page_request->SetString("onlineUrl", request.url().spec());
128 save_page_request->SetDouble("creationTime", 128 save_page_request->SetDouble("creationTime",
129 request.creation_time().ToJsTime()); 129 request.creation_time().ToJsTime());
130 save_page_request->SetString("status", GetStringFromSavePageStatus()); 130 save_page_request->SetString("status", GetStringFromSavePageStatus());
131 save_page_request->SetString("namespace", request.client_id().name_space); 131 save_page_request->SetString("namespace", request.client_id().name_space);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698