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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // To be visible in Downloads UI, these items need a well-formed GUID | 282 // To be visible in Downloads UI, these items need a well-formed GUID |
283 // and AsyncNamespace in their ClientId. | 283 // and AsyncNamespace in their ClientId. |
284 std::ostringstream id_stream; | 284 std::ostringstream id_stream; |
285 id_stream << base::GenerateGUID(); | 285 id_stream << base::GenerateGUID(); |
286 | 286 |
287 offline_pages::RequestCoordinator::SavePageLaterParams params; | 287 offline_pages::RequestCoordinator::SavePageLaterParams params; |
288 params.url = GURL(url); | 288 params.url = GURL(url); |
289 params.client_id = offline_pages::ClientId(offline_pages::kAsyncNamespace, | 289 params.client_id = offline_pages::ClientId(offline_pages::kAsyncNamespace, |
290 id_stream.str()); | 290 id_stream.str()); |
291 ResolveJavascriptCallback( | 291 ResolveJavascriptCallback( |
292 *callback_id, base::FundamentalValue( | 292 *callback_id, |
293 request_coordinator_->SavePageLater(params) > 0)); | 293 base::Value(request_coordinator_->SavePageLater(params) > 0)); |
294 } else { | 294 } else { |
295 ResolveJavascriptCallback(*callback_id, base::FundamentalValue(false)); | 295 ResolveJavascriptCallback(*callback_id, base::Value(false)); |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 void OfflineInternalsUIMessageHandler::RegisterMessages() { | 299 void OfflineInternalsUIMessageHandler::RegisterMessages() { |
300 web_ui()->RegisterMessageCallback( | 300 web_ui()->RegisterMessageCallback( |
301 "deleteSelectedPages", | 301 "deleteSelectedPages", |
302 base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, | 302 base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, |
303 weak_ptr_factory_.GetWeakPtr())); | 303 weak_ptr_factory_.GetWeakPtr())); |
304 web_ui()->RegisterMessageCallback( | 304 web_ui()->RegisterMessageCallback( |
305 "deleteSelectedRequests", | 305 "deleteSelectedRequests", |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 // Get the offline page model associated with this web ui. | 342 // Get the offline page model associated with this web ui. |
343 Profile* profile = Profile::FromWebUI(web_ui()); | 343 Profile* profile = Profile::FromWebUI(web_ui()); |
344 offline_page_model_ = | 344 offline_page_model_ = |
345 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); | 345 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); |
346 request_coordinator_ = | 346 request_coordinator_ = |
347 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); | 347 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); |
348 } | 348 } |
349 | 349 |
350 } // namespace offline_internals | 350 } // namespace offline_internals |
OLD | NEW |