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

Side by Side Diff: chrome/browser/ui/webui/history_ui.h

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed styling issue Created 6 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_HISTORY_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/scoped_observer.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
12 #include "base/task/cancelable_task_tracker.h" 13 #include "base/task/cancelable_task_tracker.h"
13 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/browser/history/history_service.h"
16 #include "chrome/browser/history/web_history_service.h" 16 #include "chrome/browser/history/web_history_service.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "components/history/core/browser/history_service_observer.h"
18 #include "content/public/browser/web_ui_controller.h" 18 #include "content/public/browser/web_ui_controller.h"
19 #include "content/public/browser/web_ui_message_handler.h" 19 #include "content/public/browser/web_ui_message_handler.h"
20 20
21 class BookmarkModel; 21 class BookmarkModel;
22 class HistoryService;
22 class ProfileSyncService; 23 class ProfileSyncService;
23 class SupervisedUserService; 24 class SupervisedUserService;
24 25
25 // The handler for Javascript messages related to the "history" view. 26 // The handler for Javascript messages related to the "history" view.
26 class BrowsingHistoryHandler : public content::WebUIMessageHandler, 27 class BrowsingHistoryHandler : public content::WebUIMessageHandler,
27 public content::NotificationObserver { 28 public history::HistoryServiceObserver {
28 public: 29 public:
29 // Represents a history entry to be shown to the user, representing either 30 // Represents a history entry to be shown to the user, representing either
30 // a local or remote visit. A single entry can represent multiple visits, 31 // a local or remote visit. A single entry can represent multiple visits,
31 // since only the most recent visit on a particular day is shown. 32 // since only the most recent visit on a particular day is shown.
32 struct HistoryEntry { 33 struct HistoryEntry {
33 // Values indicating whether an entry represents only local visits, only 34 // Values indicating whether an entry represents only local visits, only
34 // remote visits, or a mixture of both. 35 // remote visits, or a mixture of both.
35 enum EntryType { 36 enum EntryType {
36 EMPTY_ENTRY = 0, 37 EMPTY_ENTRY = 0,
37 LOCAL_ENTRY, 38 LOCAL_ENTRY,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 // Handler for the "removeVisits" message. 101 // Handler for the "removeVisits" message.
101 void HandleRemoveVisits(const base::ListValue* args); 102 void HandleRemoveVisits(const base::ListValue* args);
102 103
103 // Handler for "clearBrowsingData" message. 104 // Handler for "clearBrowsingData" message.
104 void HandleClearBrowsingData(const base::ListValue* args); 105 void HandleClearBrowsingData(const base::ListValue* args);
105 106
106 // Handler for "removeBookmark" message. 107 // Handler for "removeBookmark" message.
107 void HandleRemoveBookmark(const base::ListValue* args); 108 void HandleRemoveBookmark(const base::ListValue* args);
108 109
109 // content::NotificationObserver implementation.
110 void Observe(int type,
111 const content::NotificationSource& source,
112 const content::NotificationDetails& details) override;
113
114 // Merges duplicate entries from the query results, only retaining the most 110 // Merges duplicate entries from the query results, only retaining the most
115 // recent visit to a URL on a particular day. That visit contains the 111 // recent visit to a URL on a particular day. That visit contains the
116 // timestamps of the other visits. 112 // timestamps of the other visits.
117 static void MergeDuplicateResults( 113 static void MergeDuplicateResults(
118 std::vector<BrowsingHistoryHandler::HistoryEntry>* results); 114 std::vector<BrowsingHistoryHandler::HistoryEntry>* results);
119 115
120 private: 116 private:
121 // The range for which to return results: 117 // The range for which to return results:
122 // - ALLTIME: allows access to all the results in a paginated way. 118 // - ALLTIME: allows access to all the results in a paginated way.
123 // - WEEK: the last 7 days. 119 // - WEEK: the last 7 days.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 159
164 // Sets the query options for a week-wide query, |offset| weeks ago. 160 // Sets the query options for a week-wide query, |offset| weeks ago.
165 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options); 161 void SetQueryTimeInWeeks(int offset, history::QueryOptions* options);
166 162
167 // Sets the query options for a monthly query, |offset| months ago. 163 // Sets the query options for a monthly query, |offset| months ago.
168 void SetQueryTimeInMonths(int offset, history::QueryOptions* options); 164 void SetQueryTimeInMonths(int offset, history::QueryOptions* options);
169 165
170 // kAcceptLanguages pref value. 166 // kAcceptLanguages pref value.
171 std::string GetAcceptLanguages() const; 167 std::string GetAcceptLanguages() const;
172 168
173 content::NotificationRegistrar registrar_; 169 // history::HistoryServiceObserver:
170 void OnURLsDeleted(HistoryService* history_service,
171 bool all_history,
172 bool expired,
173 const history::URLRows& deleted_rows,
174 const std::set<GURL>& favicon_urls) override;
174 175
175 // Tracker for search requests to the history service. 176 // Tracker for search requests to the history service.
176 base::CancelableTaskTracker query_task_tracker_; 177 base::CancelableTaskTracker query_task_tracker_;
177 178
178 // The currently-executing request for synced history results. 179 // The currently-executing request for synced history results.
179 // Deleting the request will cancel it. 180 // Deleting the request will cancel it.
180 scoped_ptr<history::WebHistoryService::Request> web_history_request_; 181 scoped_ptr<history::WebHistoryService::Request> web_history_request_;
181 182
182 // True if there is a pending delete requests to the history service. 183 // True if there is a pending delete requests to the history service.
183 bool has_pending_delete_request_; 184 bool has_pending_delete_request_;
184 185
185 // Tracker for delete requests to the history service. 186 // Tracker for delete requests to the history service.
186 base::CancelableTaskTracker delete_task_tracker_; 187 base::CancelableTaskTracker delete_task_tracker_;
187 188
188 // The list of URLs that are in the process of being deleted. 189 // The list of URLs that are in the process of being deleted.
189 std::set<GURL> urls_to_be_deleted_; 190 std::set<GURL> urls_to_be_deleted_;
190 191
191 // The info value that is returned to the front end with the query results. 192 // The info value that is returned to the front end with the query results.
192 base::DictionaryValue results_info_value_; 193 base::DictionaryValue results_info_value_;
193 194
194 // The list of query results received from the history service. 195 // The list of query results received from the history service.
195 std::vector<HistoryEntry> query_results_; 196 std::vector<HistoryEntry> query_results_;
196 197
197 // The list of query results received from the history server. 198 // The list of query results received from the history server.
198 std::vector<HistoryEntry> web_history_query_results_; 199 std::vector<HistoryEntry> web_history_query_results_;
199 200
200 // Timer used to implement a timeout on a Web History response. 201 // Timer used to implement a timeout on a Web History response.
201 base::OneShotTimer<BrowsingHistoryHandler> web_history_timer_; 202 base::OneShotTimer<BrowsingHistoryHandler> web_history_timer_;
202 203
204 ScopedObserver<HistoryService, HistoryServiceObserver>
205 history_service_observer_;
206
203 base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_; 207 base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_;
204 208
205 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler); 209 DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler);
206 }; 210 };
207 211
208 class HistoryUI : public content::WebUIController { 212 class HistoryUI : public content::WebUIController {
209 public: 213 public:
210 explicit HistoryUI(content::WebUI* web_ui); 214 explicit HistoryUI(content::WebUI* web_ui);
211 215
212 static base::RefCountedMemory* GetFaviconResourceBytes( 216 static base::RefCountedMemory* GetFaviconResourceBytes(
213 ui::ScaleFactor scale_factor); 217 ui::ScaleFactor scale_factor);
214 218
215 private: 219 private:
216 DISALLOW_COPY_AND_ASSIGN(HistoryUI); 220 DISALLOW_COPY_AND_ASSIGN(HistoryUI);
217 }; 221 };
218 222
219 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ 223 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698