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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // decompresses collected favicons and updates a JumpList. | 144 // decompresses collected favicons and updates a JumpList. |
145 void StartLoadingFavicon(); | 145 void StartLoadingFavicon(); |
146 | 146 |
147 // A callback function for HistoryService that notify when a requested favicon | 147 // A callback function for HistoryService that notify when a requested favicon |
148 // is available. | 148 // is available. |
149 // To avoid file operations, this function just attaches the given data to | 149 // To avoid file operations, this function just attaches the given data to |
150 // a ShellLinkItem object. | 150 // a ShellLinkItem object. |
151 void OnFaviconDataAvailable( | 151 void OnFaviconDataAvailable( |
152 const favicon_base::FaviconImageResult& image_result); | 152 const favicon_base::FaviconImageResult& image_result); |
153 | 153 |
154 // Callback for TopSites that notifies when the "Most | 154 // Callback for TopSites that notifies when the "Most Visited" list is |
155 // Visited" list is available. This function updates the ShellLinkItemList | 155 // available. This function updates the ShellLinkItemList objects and |
156 // objects and send another query that retrieves a favicon for each URL in | 156 // begins the process of fetching favicons for the URLs. |
157 // the list. | |
158 void OnMostVisitedURLsAvailable( | 157 void OnMostVisitedURLsAvailable( |
159 const history::MostVisitedURLList& data); | 158 const history::MostVisitedURLList& data); |
160 | 159 |
161 // Callback for changes to the incognito mode availability pref. | 160 // Callback for changes to the incognito mode availability pref. |
162 void OnIncognitoAvailabilityChanged(); | 161 void OnIncognitoAvailabilityChanged(); |
163 | 162 |
164 // Helper for RunUpdate() that determines its parameters. | 163 // Posts tasks to update the JumpList and delete any obsolete JumpList related |
| 164 // folders. |
165 void PostRunUpdate(); | 165 void PostRunUpdate(); |
166 | 166 |
167 // Called on a timer to invoke RunUpdateJumpList() after | |
168 // requests storms have subsided. | |
169 void DeferredRunUpdate(); | |
170 | |
171 // history::TopSitesObserver implementation. | 167 // history::TopSitesObserver implementation. |
172 void TopSitesLoaded(history::TopSites* top_sites) override; | 168 void TopSitesLoaded(history::TopSites* top_sites) override; |
173 void TopSitesChanged(history::TopSites* top_sites, | 169 void TopSitesChanged(history::TopSites* top_sites, |
174 ChangeReason change_reason) override; | 170 ChangeReason change_reason) override; |
175 | 171 |
| 172 // Called on a timer to update the most visited URLs after requests storms |
| 173 // have subsided. |
| 174 void DeferredTopSitesChanged(); |
| 175 |
| 176 // Called on a timer to update the "Recently Closed" category of JumpList |
| 177 // after requests storms have subsided. |
| 178 void DeferredTabRestoreServiceChanged(); |
| 179 |
176 // Tracks FaviconService tasks. | 180 // Tracks FaviconService tasks. |
177 base::CancelableTaskTracker cancelable_task_tracker_; | 181 base::CancelableTaskTracker cancelable_task_tracker_; |
178 | 182 |
179 // The Profile object is used to listen for events | 183 // The Profile object is used to listen for events |
180 Profile* profile_; | 184 Profile* profile_; |
181 | 185 |
182 // Lives on the UI thread. | 186 // Lives on the UI thread. |
183 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; | 187 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
184 | 188 |
185 // App id to associate with the jump list. | 189 // App id to associate with the jump list. |
186 std::wstring app_id_; | 190 std::wstring app_id_; |
187 | 191 |
188 // Timer for requesting delayed updates of the jumplist. | 192 // Timer for requesting delayed updates of the "Most Visited" category of |
189 base::OneShotTimer timer_; | 193 // jumplist. |
| 194 base::OneShotTimer timer_most_visited_; |
| 195 |
| 196 // Timer for requesting delayed updates of the "Recently Closed" category of |
| 197 // jumplist. |
| 198 base::OneShotTimer timer_recently_closed_; |
190 | 199 |
191 // Holds data that can be accessed from multiple threads. | 200 // Holds data that can be accessed from multiple threads. |
192 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; | 201 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; |
193 | 202 |
194 // Id of last favicon task. It's used to cancel current task if a new one | 203 // Id of last favicon task. It's used to cancel current task if a new one |
195 // comes in before it finishes. | 204 // comes in before it finishes. |
196 base::CancelableTaskTracker::TaskId task_id_; | 205 base::CancelableTaskTracker::TaskId task_id_; |
197 | 206 |
198 // A task runner running tasks to update the JumpList. | 207 // A task runner running tasks to update the JumpList. |
199 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; | 208 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; |
200 | 209 |
201 // A task runner running tasks to delete JumpListIcons directory and | 210 // A task runner running tasks to delete JumpListIcons directory and |
202 // JumpListIconsOld directory. | 211 // JumpListIconsOld directory. |
203 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; | 212 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; |
204 | 213 |
205 // For callbacks may be run after destruction. | 214 // For callbacks may be run after destruction. |
206 base::WeakPtrFactory<JumpList> weak_ptr_factory_; | 215 base::WeakPtrFactory<JumpList> weak_ptr_factory_; |
207 | 216 |
208 DISALLOW_COPY_AND_ASSIGN(JumpList); | 217 DISALLOW_COPY_AND_ASSIGN(JumpList); |
209 }; | 218 }; |
210 | 219 |
211 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ | 220 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ |
OLD | NEW |