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

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

Issue 2342603004: [Offline pages] Clean up unnecessary DeleteAll calls in offline internals (Closed)
Patch Set: update button text 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"
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 "content/public/browser/web_ui_message_handler.h" 13 #include "content/public/browser/web_ui_message_handler.h"
14 14
15 namespace offline_internals { 15 namespace offline_internals {
16 16
17 // Class acting as a controller of the chrome://offline-internals WebUI. 17 // Class acting as a controller of the chrome://offline-internals WebUI.
18 class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler { 18 class OfflineInternalsUIMessageHandler : public content::WebUIMessageHandler {
19 public: 19 public:
20 OfflineInternalsUIMessageHandler(); 20 OfflineInternalsUIMessageHandler();
21 ~OfflineInternalsUIMessageHandler() override; 21 ~OfflineInternalsUIMessageHandler() override;
22 22
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.
28 void HandleDeleteAllPages(const base::ListValue* args);
29
30 // Delete selected list of page ids from the store. 27 // Delete selected list of page ids from the store.
31 void HandleDeleteSelectedPages(const base::ListValue* args); 28 void HandleDeleteSelectedPages(const base::ListValue* args);
32 29
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. 30 // Delete selected list of requests from the request queue.
37 void HandleDeleteSelectedRequests(const base::ListValue* args); 31 void HandleDeleteSelectedRequests(const base::ListValue* args);
38 32
39 // Load Request Queue info. 33 // Load Request Queue info.
40 void HandleGetRequestQueue(const base::ListValue* args); 34 void HandleGetRequestQueue(const base::ListValue* args);
41 35
42 // Load Stored pages info. 36 // Load Stored pages info.
43 void HandleGetStoredPages(const base::ListValue* args); 37 void HandleGetStoredPages(const base::ListValue* args);
44 38
45 // Set whether to record offline page model events. 39 // Set whether to record offline page model events.
46 void HandleSetRecordPageModel(const base::ListValue* args); 40 void HandleSetRecordPageModel(const base::ListValue* args);
47 41
48 // Set whether to record request queue events. 42 // Set whether to record request queue events.
49 void HandleSetRecordRequestQueue(const base::ListValue* args); 43 void HandleSetRecordRequestQueue(const base::ListValue* args);
50 44
51 // Load both Page Model and Request Queue event logs. 45 // Load both Page Model and Request Queue event logs.
52 void HandleGetEventLogs(const base::ListValue* args); 46 void HandleGetEventLogs(const base::ListValue* args);
53 47
54 // Load whether logs are being recorded. 48 // Load whether logs are being recorded.
55 void HandleGetLoggingState(const base::ListValue* args); 49 void HandleGetLoggingState(const base::ListValue* args);
56 50
57 // Adds a url to the background loader queue. 51 // Adds a url to the background loader queue.
58 void HandleAddToRequestQueue(const base::ListValue* args); 52 void HandleAddToRequestQueue(const base::ListValue* args);
59 53
60 // Load whether device is currently offline. 54 // Load whether device is currently offline.
61 void HandleGetNetworkStatus(const base::ListValue* args); 55 void HandleGetNetworkStatus(const base::ListValue* args);
62 56
63 // Callback used by DeleteAllRequests to get the request_ids to delete.
64 void HandleGetAllRequestsForDeleteCallback(
65 std::string callback_id,
66 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests);
67
68 // Callback for async GetAllPages calls. 57 // Callback for async GetAllPages calls.
69 void HandleStoredPagesCallback( 58 void HandleStoredPagesCallback(
70 std::string callback_id, 59 std::string callback_id,
71 const offline_pages::MultipleOfflinePageItemResult& pages); 60 const offline_pages::MultipleOfflinePageItemResult& pages);
72 61
73 // Callback for async GetRequests calls. 62 // Callback for async GetRequests calls.
74 void HandleRequestQueueCallback( 63 void HandleRequestQueueCallback(
75 std::string callback_id, 64 std::string callback_id,
76 offline_pages::RequestQueue::GetRequestsResult result, 65 offline_pages::RequestQueue::GetRequestsResult result,
77 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests); 66 std::vector<std::unique_ptr<offline_pages::SavePageRequest>> requests);
(...skipping 26 matching lines...) Expand all
104 93
105 // Factory for creating references in callbacks. 94 // Factory for creating references in callbacks.
106 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_; 95 base::WeakPtrFactory<OfflineInternalsUIMessageHandler> weak_ptr_factory_;
107 96
108 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler); 97 DISALLOW_COPY_AND_ASSIGN(OfflineInternalsUIMessageHandler);
109 }; 98 };
110 99
111 } // namespace offline_internals 100 } // namespace offline_internals
112 101
113 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H _ 102 #endif // CHROME_BROWSER_UI_WEBUI_OFFLINE_OFFLINE_INTERNALS_UI_MESSAGE_HANDLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698