| 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 #ifndef CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/offline_pages/background/request_coordinator.h" | 10 #include "components/offline_pages/background/request_coordinator.h" |
| 11 #include "components/offline_pages/background/save_page_request.h" | 11 #include "components/offline_pages/background/save_page_request.h" |
| 12 #include "components/offline_pages/offline_page_model.h" | 12 #include "components/offline_pages/offline_page_model.h" |
| 13 #include "components/offline_pages/offline_store_types.h" |
| 13 #include "content/public/browser/web_ui_message_handler.h" | 14 #include "content/public/browser/web_ui_message_handler.h" |
| 14 | 15 |
| 15 namespace offline_internals { | 16 namespace offline_internals { |
| 16 | 17 |
| 17 // Class acting as a controller of the chrome://offline-internals WebUI. | 18 // Class acting as a controller of the chrome://offline-internals WebUI. |
| 18 class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler { | 19 class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler { |
| 19 public: | 20 public: |
| 20 OfflineInternalsUIMessageHandler(); | 21 OfflineInternalsUIMessageHandler(); |
| 21 ~OfflineInternalsUIMessageHandler() override; | 22 ~OfflineInternalsUIMessageHandler() override; |
| 22 | 23 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 offline_pages::RequestQueue::GetRequestsResult result, | 66 offline_pages::RequestQueue::GetRequestsResult result, |
| 66 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests); | 67 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests); |
| 67 | 68 |
| 68 // Callback for DeletePage/DeleteAllPages calls. | 69 // Callback for DeletePage/DeleteAllPages calls. |
| 69 void HandleDeletedPagesCallback(std::string callback_id, | 70 void HandleDeletedPagesCallback(std::string callback_id, |
| 70 const offline_pages::DeletePageResult result); | 71 const offline_pages::DeletePageResult result); |
| 71 | 72 |
| 72 // Callback for DeleteRequest/DeleteAllRequests calls. | 73 // Callback for DeleteRequest/DeleteAllRequests calls. |
| 73 void HandleDeletedRequestsCallback( | 74 void HandleDeletedRequestsCallback( |
| 74 std::string callback_id, | 75 std::string callback_id, |
| 75 const offline_pages::RequestQueue::UpdateMultipleRequestResults& results); | 76 const offline_pages::MultipleItemStatuses& results); |
| 76 | 77 |
| 77 // Turns a DeletePageResult enum into logical string. | 78 // Turns a DeletePageResult enum into logical string. |
| 78 std::string GetStringFromDeletePageResult( | 79 std::string GetStringFromDeletePageResult( |
| 79 offline_pages::DeletePageResult value); | 80 offline_pages::DeletePageResult value); |
| 80 | 81 |
| 81 // Summarizes the UpdateMultipleRequestResults vector with a string. | 82 // Summarizes the MultipleItemStatuses vector with a string. |
| 82 std::string GetStringFromDeleteRequestResults( | 83 std::string GetStringFromDeleteRequestResults( |
| 83 const offline_pages::RequestQueue::UpdateMultipleRequestResults& result); | 84 const offline_pages::MultipleItemStatuses& result); |
| 84 | 85 |
| 85 // Turns a SavePageRequest::Status into logical string. | 86 // Turns a SavePageRequest::Status into logical string. |
| 86 std::string GetStringFromSavePageStatus(); | 87 std::string GetStringFromSavePageStatus(); |
| 87 | 88 |
| 88 // Offline page model to call methods on. | 89 // Offline page model to call methods on. |
| 89 offline_pages::OfflinePageModel* offline_page_model_; | 90 offline_pages::OfflinePageModel* offline_page_model_; |
| 90 | 91 |
| 91 // Request coordinator for background offline actions. | 92 // Request coordinator for background offline actions. |
| 92 offline_pages::RequestCoordinator* request_coordinator_; | 93 offline_pages::RequestCoordinator* request_coordinator_; |
| 93 | 94 |
| 94 // Factory for creating references in callbacks. | 95 // Factory for creating references in callbacks. |
| 95 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_; | 96 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_; |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler); | 98 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace offline_internals | 101 } // namespace offline_internals |
| 101 | 102 |
| 102 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H
_ | 103 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H
_ |
| OLD | NEW |