OLD | NEW |
---|---|
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_WIN_JUMPLIST_H_ | 5 #ifndef CHROME_BROWSER_WIN_JUMPLIST_H_ |
6 #define CHROME_BROWSER_WIN_JUMPLIST_H_ | 6 #define CHROME_BROWSER_WIN_JUMPLIST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 // has new updates therefore its icons need to be updated. | 95 // has new updates therefore its icons need to be updated. |
96 // By default, this flag is set to false. If there's any change in TopSites | 96 // By default, this flag is set to false. If there's any change in TopSites |
97 // service, this flag will be set to true. | 97 // service, this flag will be set to true. |
98 bool recently_closed_pages_have_updates_ = false; | 98 bool recently_closed_pages_have_updates_ = false; |
99 }; | 99 }; |
100 | 100 |
101 // Observer callback for TabRestoreService::Observer to notify when a tab is | 101 // Observer callback for TabRestoreService::Observer to notify when a tab is |
102 // added or removed. | 102 // added or removed. |
103 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; | 103 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; |
104 | 104 |
105 // Called on a timer to update the "Recently Closed" category of JumpList | |
grt (UTC plus 2)
2017/05/04 11:32:43
nit: it's generally nice to group overrides togeth
chengx
2017/05/04 20:48:04
Done.
| |
106 // after requests storms have subsided. | |
107 void DeferredTabRestoreServiceChanged(); | |
108 | |
105 // Observer callback to notice when our associated TabRestoreService | 109 // Observer callback to notice when our associated TabRestoreService |
106 // is destroyed. | 110 // is destroyed. |
107 void TabRestoreServiceDestroyed( | 111 void TabRestoreServiceDestroyed( |
108 sessions::TabRestoreService* service) override; | 112 sessions::TabRestoreService* service) override; |
109 | 113 |
110 // Cancel a pending jumplist update. | 114 // Cancel a pending jumplist update. |
111 void CancelPendingUpdate(); | 115 void CancelPendingUpdate(); |
112 | 116 |
113 // Terminate the jumplist: cancel any pending updates and stop observing | 117 // Terminate the jumplist: cancel any pending updates and stop observing |
114 // the Profile and its services. This must be called before the |profile_| | 118 // the Profile and its services. This must be called before the |profile_| |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 // decompresses collected favicons and updates a JumpList. | 152 // decompresses collected favicons and updates a JumpList. |
149 void StartLoadingFavicon(); | 153 void StartLoadingFavicon(); |
150 | 154 |
151 // A callback function for HistoryService that notify when a requested favicon | 155 // A callback function for HistoryService that notify when a requested favicon |
152 // is available. | 156 // is available. |
153 // To avoid file operations, this function just attaches the given data to | 157 // To avoid file operations, this function just attaches the given data to |
154 // a ShellLinkItem object. | 158 // a ShellLinkItem object. |
155 void OnFaviconDataAvailable( | 159 void OnFaviconDataAvailable( |
156 const favicon_base::FaviconImageResult& image_result); | 160 const favicon_base::FaviconImageResult& image_result); |
157 | 161 |
158 // Callback for TopSites that notifies when the "Most | 162 // Callback for TopSites that notifies when the "Most Visited" list is |
159 // Visited" list is available. This function updates the ShellLinkItemList | 163 // available. This function updates the ShellLinkItemList objects and sen |
grt (UTC plus 2)
2017/05/04 11:32:43
"...and sen" -> "...and begins the process of fetc
chengx
2017/05/04 20:48:04
Done.
| |
160 // objects and send another query that retrieves a favicon for each URL in | 164 // another query that retrieves a favicon for each URL in the list. |
161 // the list. | |
162 void OnMostVisitedURLsAvailable( | 165 void OnMostVisitedURLsAvailable( |
163 const history::MostVisitedURLList& data); | 166 const history::MostVisitedURLList& data); |
164 | 167 |
165 // Callback for changes to the incognito mode availability pref. | 168 // Callback for changes to the incognito mode availability pref. |
166 void OnIncognitoAvailabilityChanged(); | 169 void OnIncognitoAvailabilityChanged(); |
167 | 170 |
168 // Helper for RunUpdate() that determines its parameters. | 171 // Posts tasks to update the JumpList and delete any obsolete JumpList related |
172 // folders. | |
169 void PostRunUpdate(); | 173 void PostRunUpdate(); |
170 | 174 |
171 // Called on a timer to invoke RunUpdateJumpList() after | |
172 // requests storms have subsided. | |
173 void DeferredRunUpdate(); | |
174 | |
175 // history::TopSitesObserver implementation. | 175 // history::TopSitesObserver implementation. |
176 void TopSitesLoaded(history::TopSites* top_sites) override; | 176 void TopSitesLoaded(history::TopSites* top_sites) override; |
177 void TopSitesChanged(history::TopSites* top_sites, | 177 void TopSitesChanged(history::TopSites* top_sites, |
178 ChangeReason change_reason) override; | 178 ChangeReason change_reason) override; |
179 | 179 |
180 // Called on a timer to update the most visited URLs after requests storms | |
181 // have subsided. | |
182 void DeferredTopSitesChanged(); | |
183 | |
180 // Tracks FaviconService tasks. | 184 // Tracks FaviconService tasks. |
181 base::CancelableTaskTracker cancelable_task_tracker_; | 185 base::CancelableTaskTracker cancelable_task_tracker_; |
182 | 186 |
183 // The Profile object is used to listen for events | 187 // The Profile object is used to listen for events |
184 Profile* profile_; | 188 Profile* profile_; |
185 | 189 |
186 // Lives on the UI thread. | 190 // Lives on the UI thread. |
187 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; | 191 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
188 | 192 |
189 // App id to associate with the jump list. | 193 // App id to associate with the jump list. |
190 std::wstring app_id_; | 194 std::wstring app_id_; |
191 | 195 |
192 // The directory which contains JumpList icons. | 196 // The directory which contains JumpList icons. |
193 base::FilePath icon_dir_; | 197 base::FilePath icon_dir_; |
194 | 198 |
195 // Timer for requesting delayed updates of the jumplist. | 199 // Timer for requesting delayed updates of the "Most Visited" category of |
196 base::OneShotTimer timer_; | 200 // jumplist. |
201 base::OneShotTimer timer_most_visited_; | |
202 | |
203 // Timer for requesting delayed updates of the "Recently Closed" category of | |
204 // jumplist. | |
205 base::OneShotTimer timer_recently_closed_; | |
197 | 206 |
198 // Holds data that can be accessed from multiple threads. | 207 // Holds data that can be accessed from multiple threads. |
199 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; | 208 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; |
200 | 209 |
201 // Id of last favicon task. It's used to cancel current task if a new one | 210 // Id of last favicon task. It's used to cancel current task if a new one |
202 // comes in before it finishes. | 211 // comes in before it finishes. |
203 base::CancelableTaskTracker::TaskId task_id_; | 212 base::CancelableTaskTracker::TaskId task_id_; |
204 | 213 |
205 // A task runner running tasks to update the JumpList. | 214 // A task runner running tasks to update the JumpList. |
206 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; | 215 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; |
207 | 216 |
208 // A task runner running tasks to delete JumpListIcons directory and | 217 // A task runner running tasks to delete JumpListIcons directory and |
209 // JumpListIconsOld directory. | 218 // JumpListIconsOld directory. |
210 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; | 219 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; |
211 | 220 |
212 // For callbacks may be run after destruction. | 221 // For callbacks may be run after destruction. |
213 base::WeakPtrFactory<JumpList> weak_ptr_factory_; | 222 base::WeakPtrFactory<JumpList> weak_ptr_factory_; |
214 | 223 |
215 DISALLOW_COPY_AND_ASSIGN(JumpList); | 224 DISALLOW_COPY_AND_ASSIGN(JumpList); |
216 }; | 225 }; |
217 | 226 |
218 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ | 227 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ |
OLD | NEW |