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

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

Issue 2928243002: Return operation name in prefetch request callback and add internal page hookup (Closed)
Patch Set: Address feedback Created 3 years, 6 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 #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/core/background/request_coordinator.h" 10 #include "components/offline_pages/core/background/request_coordinator.h"
11 #include "components/offline_pages/core/background/save_page_request.h" 11 #include "components/offline_pages/core/background/save_page_request.h"
12 #include "components/offline_pages/core/offline_page_model.h" 12 #include "components/offline_pages/core/offline_page_model.h"
13 #include "components/offline_pages/core/offline_store_types.h" 13 #include "components/offline_pages/core/offline_store_types.h"
14 #include "components/offline_pages/core/prefetch/prefetch_types.h"
14 #include "content/public/browser/web_ui_message_handler.h" 15 #include "content/public/browser/web_ui_message_handler.h"
15 16
16 namespace offline_pages { 17 namespace offline_pages {
17 enum class GetRequestsResult; 18 enum class GetRequestsResult;
19 class GeneratePageBundleRequest;
20 class GetOperationRequest;
18 } 21 }
19 22
20 namespace offline_internals { 23 namespace offline_internals {
21 24
22 // Class acting as a controller of the chrome://offline-internals WebUI. 25 // Class acting as a controller of the chrome://offline-internals WebUI.
23 class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler { 26 class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler {
24 public: 27 public:
25 OfflineInternalsUIMessageHandler(); 28 OfflineInternalsUIMessageHandler();
26 ~OfflineInternalsUIMessageHandler() override; 29 ~OfflineInternalsUIMessageHandler() override;
27 30
(...skipping 30 matching lines...) Expand all
58 61
59 // Load whether device is currently offline. 62 // Load whether device is currently offline.
60 void HandleGetNetworkStatus(const base::ListValue* args); 63 void HandleGetNetworkStatus(const base::ListValue* args);
61 64
62 // Schedules an NWake signal. 65 // Schedules an NWake signal.
63 void HandleScheduleNwake(const base::ListValue* args); 66 void HandleScheduleNwake(const base::ListValue* args);
64 67
65 // Cancels an NWake signal. 68 // Cancels an NWake signal.
66 void HandleCancelNwake(const base::ListValue* args); 69 void HandleCancelNwake(const base::ListValue* args);
67 70
71 // Sends a request to genrate page bundle.
dpapad 2017/06/12 23:29:20 The comment sounds a bit confusing. Does calling "
72 void HandleGeneratePageBundle(const base::ListValue* args);
73
74 // Sends a request to get operation.
75 void HandleGetOperation(const base::ListValue* args);
76
68 // Callback for async GetAllPages calls. 77 // Callback for async GetAllPages calls.
69 void HandleStoredPagesCallback( 78 void HandleStoredPagesCallback(
70 std::string callback_id, 79 std::string callback_id,
71 const offline_pages::MultipleOfflinePageItemResult& pages); 80 const offline_pages::MultipleOfflinePageItemResult& pages);
72 81
73 // Callback for async GetRequests calls. 82 // Callback for async GetRequests calls.
74 void HandleRequestQueueCallback( 83 void HandleRequestQueueCallback(
75 std::string callback_id, 84 std::string callback_id,
76 offline_pages::GetRequestsResult result, 85 offline_pages::GetRequestsResult result,
77 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests); 86 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests);
78 87
79 // Callback for DeletePage/DeleteAllPages calls. 88 // Callback for DeletePage/DeleteAllPages calls.
80 void HandleDeletedPagesCallback(std::string callback_id, 89 void HandleDeletedPagesCallback(std::string callback_id,
81 const offline_pages::DeletePageResult result); 90 const offline_pages::DeletePageResult result);
82 91
83 // Callback for DeleteRequest/DeleteAllRequests calls. 92 // Callback for DeleteRequest/DeleteAllRequests calls.
84 void HandleDeletedRequestsCallback( 93 void HandleDeletedRequestsCallback(
85 std::string callback_id, 94 std::string callback_id,
86 const offline_pages::MultipleItemStatuses& results); 95 const offline_pages::MultipleItemStatuses& results);
87 96
88 // Turns a DeletePageResult enum into logical string. 97 // Callback for GeneratePageBundle/GetOperation request calls.
89 std::string GetStringFromDeletePageResult( 98 void HandlePrefetchRequestCallback(
90 offline_pages::DeletePageResult value); 99 std::string callback_id,
100 offline_pages::PrefetchRequestStatus status,
101 const std::string& operation_name,
102 const std::vector<offline_pages::RenderPageInfo>& pages);
91 103
92 // Summarizes the MultipleItemStatuses vector with a string. 104 // Callback for GetOperation calls.
93 std::string GetStringFromDeleteRequestResults( 105 void HandleGetOperationCallback(
94 const offline_pages::MultipleItemStatuses& result); 106 std::string callback_id,
95 107 offline_pages::PrefetchRequestStatus status,
96 // Turns a SavePageRequest::Status into logical string. 108 const std::vector<offline_pages::RenderPageInfo>& pages);
97 std::string GetStringFromSavePageStatus();
98 109
99 // Offline page model to call methods on. 110 // Offline page model to call methods on.
100 offline_pages::OfflinePageModel* offline_page_model_; 111 offline_pages::OfflinePageModel* offline_page_model_;
101 112
102 // Request coordinator for background offline actions. 113 // Request coordinator for background offline actions.
103 offline_pages::RequestCoordinator* request_coordinator_; 114 offline_pages::RequestCoordinator* request_coordinator_;
104 115
116 std::unique_ptr<offline_pages::GeneratePageBundleRequest>
117 generate_page_bundle_request_;
118 std::unique_ptr<offline_pages::GetOperationRequest> get_operation_request_;
119
105 // Factory for creating references in callbacks. 120 // Factory for creating references in callbacks.
106 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_; 121 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_;
107 122
108 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler); 123 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler);
109 }; 124 };
110 125
111 } // namespace offline_internals 126 } // namespace offline_internals
112 127
113 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H _ 128 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H _
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698