Chromium Code Reviews| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 // and AsyncNamespace in their ClientId. | 281 // and AsyncNamespace in their ClientId. |
| 282 std::ostringstream id_stream; | 282 std::ostringstream id_stream; |
| 283 id_stream << base::GenerateGUID(); | 283 id_stream << base::GenerateGUID(); |
| 284 | 284 |
| 285 ResolveJavascriptCallback( | 285 ResolveJavascriptCallback( |
| 286 *callback_id, | 286 *callback_id, |
| 287 base::FundamentalValue(request_coordinator_->SavePageLater( | 287 base::FundamentalValue(request_coordinator_->SavePageLater( |
| 288 GURL(url), offline_pages::ClientId( | 288 GURL(url), offline_pages::ClientId( |
| 289 offline_pages::kAsyncNamespace, id_stream.str()), | 289 offline_pages::kAsyncNamespace, id_stream.str()), |
| 290 true, offline_pages::RequestCoordinator::RequestAvailability:: | 290 true, offline_pages::RequestCoordinator::RequestAvailability:: |
| 291 ENABLED_FOR_OFFLINER) > 0)); | 291 ENABLED_FOR_OFFLINER) != 0)); |
|
Dmitry Titov
2016/10/10 17:29:45
I think ">" is even "stronger" condition here, why
Pete Williamson
2016/10/10 19:45:17
SavePageLater now returns a request_id. The reque
Pete Williamson
2016/10/10 22:53:12
Done. Ah, I didn't realize the random number gene
| |
| 292 } else { | 292 } else { |
| 293 ResolveJavascriptCallback(*callback_id, base::FundamentalValue(false)); | 293 ResolveJavascriptCallback(*callback_id, base::FundamentalValue(false)); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 void OfflineInternalsUIMessageHandler::RegisterMessages() { | 297 void OfflineInternalsUIMessageHandler::RegisterMessages() { |
| 298 web_ui()->RegisterMessageCallback( | 298 web_ui()->RegisterMessageCallback( |
| 299 "deleteSelectedPages", | 299 "deleteSelectedPages", |
| 300 base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, | 300 base::Bind(&OfflineInternalsUIMessageHandler::HandleDeleteSelectedPages, |
| 301 weak_ptr_factory_.GetWeakPtr())); | 301 weak_ptr_factory_.GetWeakPtr())); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 | 339 |
| 340 // Get the offline page model associated with this web ui. | 340 // Get the offline page model associated with this web ui. |
| 341 Profile* profile = Profile::FromWebUI(web_ui()); | 341 Profile* profile = Profile::FromWebUI(web_ui()); |
| 342 offline_page_model_ = | 342 offline_page_model_ = |
| 343 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); | 343 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile); |
| 344 request_coordinator_ = | 344 request_coordinator_ = |
| 345 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); | 345 offline_pages::RequestCoordinatorFactory::GetForBrowserContext(profile); |
| 346 } | 346 } |
| 347 | 347 |
| 348 } // namespace offline_internals | 348 } // namespace offline_internals |
| OLD | NEW |