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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 std::string url; | 278 std::string url; |
279 CHECK(args->GetString(1, &url)); | 279 CHECK(args->GetString(1, &url)); |
280 | 280 |
281 // To be visible in Downloads UI, these items need a well-formed GUID | 281 // To be visible in Downloads UI, these items need a well-formed GUID |
282 // and AsyncNamespace in their ClientId. | 282 // and AsyncNamespace in their ClientId. |
283 std::ostringstream id_stream; | 283 std::ostringstream id_stream; |
284 id_stream << base::GenerateGUID(); | 284 id_stream << base::GenerateGUID(); |
285 | 285 |
286 ResolveJavascriptCallback( | 286 ResolveJavascriptCallback( |
287 *callback_id, | 287 *callback_id, |
288 base::FundamentalValue(request_coordinator_->SavePageLater( | 288 base::Value(request_coordinator_->SavePageLater( |
289 GURL(url), offline_pages::ClientId( | 289 GURL(url), offline_pages::ClientId( |
290 offline_pages::kAsyncNamespace, id_stream.str()), | 290 offline_pages::kAsyncNamespace, id_stream.str()), |
291 true, offline_pages::RequestCoordinator::RequestAvailability:: | 291 true, offline_pages::RequestCoordinator::RequestAvailability:: |
292 ENABLED_FOR_OFFLINER) > 0)); | 292 ENABLED_FOR_OFFLINER) > 0)); |
293 } else { | 293 } else { |
294 ResolveJavascriptCallback(*callback_id, base::FundamentalValue(false)); | 294 ResolveJavascriptCallback(*callback_id, base::Value(false)); |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 void OfflineInternalsUIMessageHandler::RegisterMessages() { | 298 void OfflineInternalsUIMessageHandler::RegisterMessages() { |
299 web_ui()->RegisterMessageCallback( | 299 web_ui()->RegisterMessageCallback( |
300 "deleteSelectedPages", | 300 "deleteSelectedPages", |
301 base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, | 301 base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, |
302 weak_ptr_factory_.GetWeakPtr())); | 302 weak_ptr_factory_.GetWeakPtr())); |
303 web_ui()->RegisterMessageCallback( | 303 web_ui()->RegisterMessageCallback( |
304 "deleteSelectedRequests", | 304 "deleteSelectedRequests", |
(...skipping 35 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 |