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

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

Issue 2328973003: Adds a delete button to chrome:offline-internals (Closed)
Patch Set: Merge fix Created 4 years, 3 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/background/request_coordinator.h" 10 #include "components/offline_pages/background/request_coordinator.h"
(...skipping 12 matching lines...) Expand all
23 // WebUIMessageHandler implementation. 23 // WebUIMessageHandler implementation.
24 void RegisterMessages() override; 24 void RegisterMessages() override;
25 25
26 private: 26 private:
27 // Deletes all the pages in the store. 27 // Deletes all the pages in the store.
28 void HandleDeleteAllPages(const base::ListValue* args); 28 void HandleDeleteAllPages(const base::ListValue* args);
29 29
30 // Delete selected list of page ids from the store. 30 // Delete selected list of page ids from the store.
31 void HandleDeleteSelectedPages(const base::ListValue* args); 31 void HandleDeleteSelectedPages(const base::ListValue* args);
32 32
33 // Deletes all the requests in the request queue.
34 void HandleDeleteAllRequests(const base::ListValue* args);
35
36 // Delete selected list of requests from the request queue.
37 void HandleDeleteSelectedRequests(const base::ListValue* args);
38
33 // Load Request Queue info. 39 // Load Request Queue info.
34 void HandleGetRequestQueue(const base::ListValue* args); 40 void HandleGetRequestQueue(const base::ListValue* args);
35 41
36 // Load Stored pages info. 42 // Load Stored pages info.
37 void HandleGetStoredPages(const base::ListValue* args); 43 void HandleGetStoredPages(const base::ListValue* args);
38 44
39 // Set whether to record offline page model events. 45 // Set whether to record offline page model events.
40 void HandleSetRecordPageModel(const base::ListValue* args); 46 void HandleSetRecordPageModel(const base::ListValue* args);
41 47
42 // Set whether to record request queue events. 48 // Set whether to record request queue events.
43 void HandleSetRecordRequestQueue(const base::ListValue* args); 49 void HandleSetRecordRequestQueue(const base::ListValue* args);
44 50
45 // Load both Page Model and Request Queue event logs. 51 // Load both Page Model and Request Queue event logs.
46 void HandleGetEventLogs(const base::ListValue* args); 52 void HandleGetEventLogs(const base::ListValue* args);
47 53
48 // Load whether logs are being recorded. 54 // Load whether logs are being recorded.
49 void HandleGetLoggingState(const base::ListValue* args); 55 void HandleGetLoggingState(const base::ListValue* args);
50 56
51 // Adds a url to the background loader queue. 57 // Adds a url to the background loader queue.
52 void HandleAddToRequestQueue(const base::ListValue* args); 58 void HandleAddToRequestQueue(const base::ListValue* args);
53 59
54 // Load whether device is currently offline. 60 // Load whether device is currently offline.
55 void HandleGetNetworkStatus(const base::ListValue* args); 61 void HandleGetNetworkStatus(const base::ListValue* args);
56 62
63 // Callback used by DeleteAllRequests to get the request_ids to delete.
64 void DeleteAllGetCallback(
chili 2016/09/12 20:26:02 nit: this method name is really confusing... what
Pete Williamson 2016/09/12 22:46:36 How about HandleGetAllRequestsForDeleteCallback.
65 std::string callback_id,
66 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests);
67
57 // Callback for async GetAllPages calls. 68 // Callback for async GetAllPages calls.
58 void HandleStoredPagesCallback( 69 void HandleStoredPagesCallback(
59 std::string callback_id, 70 std::string callback_id,
60 const offline_pages::MultipleOfflinePageItemResult& pages); 71 const offline_pages::MultipleOfflinePageItemResult& pages);
61 72
62 // Callback for async GetRequests calls. 73 // Callback for async GetRequests calls.
63 void HandleRequestQueueCallback( 74 void HandleRequestQueueCallback(
64 std::string callback_id, 75 std::string callback_id,
65 offline_pages::RequestQueue::GetRequestsResult result, 76 offline_pages::RequestQueue::GetRequestsResult result,
66 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests); 77 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests);
67 78
68 // Callback for DeletePage/ClearAll calls. 79 // Callback for DeletePage/DeleteAllPages calls.
69 void HandleDeletedPagesCallback(std::string callback_id, 80 void HandleDeletedPagesCallback(std::string callback_id,
70 const offline_pages::DeletePageResult result); 81 const offline_pages::DeletePageResult result);
71 82
83 // Callback for DeleteRequest/DeleteAllRequests calls.
84 void HandleDeletedRequestsCallback(
85 std::string callback_id,
86 const offline_pages::RequestQueue::UpdateMultipleRequestResults& results);
87
72 // Turns a DeletePageResult enum into logical string. 88 // Turns a DeletePageResult enum into logical string.
73 std::string GetStringFromDeletePageResult( 89 std::string GetStringFromDeletePageResult(
74 offline_pages::DeletePageResult value); 90 offline_pages::DeletePageResult value);
75 91
92 // Summarizes the UpdateMultipleRequestResults vector with a string.
93 std::string GetStringFromDeleteRequestResults(
94 const offline_pages::RequestQueue::UpdateMultipleRequestResults& result);
95
76 // Turns a SavePageRequest::Status into logical string. 96 // Turns a SavePageRequest::Status into logical string.
77 std::string GetStringFromSavePageStatus(); 97 std::string GetStringFromSavePageStatus();
78 98
79 // Offline page model to call methods on. 99 // Offline page model to call methods on.
80 offline_pages::OfflinePageModel* offline_page_model_; 100 offline_pages::OfflinePageModel* offline_page_model_;
81 101
82 // Request coordinator for background offline actions. 102 // Request coordinator for background offline actions.
83 offline_pages::RequestCoordinator* request_coordinator_; 103 offline_pages::RequestCoordinator* request_coordinator_;
84 104
85 // Factory for creating references in callbacks. 105 // Factory for creating references in callbacks.
86 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_; 106 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_;
87 107
88 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler); 108 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler);
89 }; 109 };
90 110
91 } // namespace offline_internals 111 } // namespace offline_internals
92 112
93 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H _ 113 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698