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> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "base/containers/flat_map.h" | 15 #include "base/containers/flat_map.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/sequence_checker.h" | 20 #include "base/sequence_checker.h" |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
grt (UTC plus 2)
2017/06/09 10:42:58
unused! hooray!
chengx
2017/06/10 05:56:18
Done. Sorry I forgot to update the header files.
| |
23 #include "base/task/cancelable_task_tracker.h" | 23 #include "base/task/cancelable_task_tracker.h" |
24 #include "base/timer/timer.h" | 24 #include "base/timer/timer.h" |
25 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 25 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
26 #include "chrome/browser/win/jumplist_updater.h" | 26 #include "chrome/browser/win/jumplist_updater.h" |
27 #include "components/history/core/browser/history_service.h" | 27 #include "components/history/core/browser/history_service.h" |
grt (UTC plus 2)
2017/06/09 10:42:58
move to .cc
chengx
2017/06/10 05:56:18
Done.
| |
28 #include "components/history/core/browser/history_types.h" | 28 #include "components/history/core/browser/history_types.h" |
29 #include "components/history/core/browser/top_sites_observer.h" | 29 #include "components/history/core/browser/top_sites_observer.h" |
30 #include "components/keyed_service/core/refcounted_keyed_service.h" | 30 #include "components/keyed_service/core/refcounted_keyed_service.h" |
31 #include "components/sessions/core/tab_restore_service.h" | 31 #include "components/sessions/core/tab_restore_service.h" |
32 #include "components/sessions/core/tab_restore_service_observer.h" | 32 #include "components/sessions/core/tab_restore_service_observer.h" |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
grt (UTC plus 2)
2017/06/09 10:42:58
unused
chengx
2017/06/10 05:56:18
I think it's used in JumpList constructor.
JumpL
grt (UTC plus 2)
2017/06/12 07:15:33
Please move it to the .cc file as per iwyu.
chengx
2017/06/12 19:13:24
Done.
| |
34 #include "content/public/browser/notification_observer.h" | 34 #include "content/public/browser/notification_observer.h" |
35 #include "content/public/browser/notification_registrar.h" | 35 #include "content/public/browser/notification_registrar.h" |
36 | 36 |
37 namespace base { | 37 namespace base { |
38 class SingleThreadTaskRunner; | 38 class SingleThreadTaskRunner; |
39 class SequencedTaskRunner; | 39 class SequencedTaskRunner; |
40 } | 40 } |
41 | 41 |
42 namespace chrome { | 42 namespace chrome { |
43 struct FaviconImageResult; | 43 struct FaviconImageResult; |
(...skipping 10 matching lines...) Expand all Loading... | |
54 // * Retrieving strings from the application resource; | 54 // * Retrieving strings from the application resource; |
55 // * Adding COM objects to JumpList, etc. | 55 // * Adding COM objects to JumpList, etc. |
56 // | 56 // |
57 // This class observes the tabs and policies of the given Profile and updates | 57 // This class observes the tabs and policies of the given Profile and updates |
58 // the JumpList whenever a change is detected. | 58 // the JumpList whenever a change is detected. |
59 // | 59 // |
60 // Updating a JumpList requires some file operations and it is not good to | 60 // Updating a JumpList requires some file operations and it is not good to |
61 // update it in a UI thread. To solve this problem, this class posts to a | 61 // update it in a UI thread. To solve this problem, this class posts to a |
62 // runnable method when it actually updates a JumpList. | 62 // runnable method when it actually updates a JumpList. |
63 // | 63 // |
64 // Note. base::CancelableTaskTracker is not thread safe, so we | 64 // Note. base::CancelableTaskTracker is not thread safe, so we |
grt (UTC plus 2)
2017/06/09 10:42:57
since all class methods are now required to run on
chengx
2017/06/10 05:56:18
Agreed. Done.
| |
65 // always delete JumpList on UI thread (the same thread it got constructed on). | 65 // always delete JumpList on UI thread (the same thread it got constructed on). |
66 class JumpList : public sessions::TabRestoreServiceObserver, | 66 class JumpList : public sessions::TabRestoreServiceObserver, |
67 public history::TopSitesObserver, | 67 public history::TopSitesObserver, |
68 public RefcountedKeyedService { | 68 public RefcountedKeyedService { |
grt (UTC plus 2)
2017/06/09 10:42:58
can this be a regular KeyedService? i don't see an
chengx
2017/06/10 05:56:18
I think refcounting is used when one user (i.e., o
grt (UTC plus 2)
2017/06/12 07:15:32
Making it a keyed service accomplishes that (one i
chengx
2017/06/12 22:05:28
I've made it not refcounted.
| |
69 public: | 69 public: |
70 struct JumpListData { | 70 using URLIconCache = base::flat_map<std::string, base::FilePath>; |
71 JumpListData(); | |
72 ~JumpListData(); | |
73 | 71 |
74 // Lock for most_visited_pages_, recently_closed_pages_, icon_urls_ | 72 // Holds results of the RunUpdateJumpList run. |
75 // as they may be used by up to 2 threads. | 73 struct JumpListUpdateResults { |
grt (UTC plus 2)
2017/06/09 10:42:58
nit: just UpdateResults since this is within JumpL
chengx
2017/06/10 05:56:18
Done. Renamed to UpdateResults and made private.
| |
76 base::Lock list_lock_; | 74 JumpListUpdateResults(); |
75 ~JumpListUpdateResults(); | |
77 | 76 |
78 // A list of URLs we need to retrieve their favicons, | 77 // Icon file paths of the most visited links, indexed by tab url. |
79 // protected by the list_lock_. | 78 // Holding a copy of most_visited_icons_ initially, it's updated by the |
80 typedef std::pair<std::string, scoped_refptr<ShellLinkItem> > URLPair; | 79 // JumpList update run. If the update run succeeds, it overwrites |
81 std::list<URLPair> icon_urls_; | 80 // most_visited_icons_. |
81 URLIconCache most_visited_icons_in_update_; | |
82 | 82 |
83 // Items in the "Most Visited" category of the application JumpList, | 83 // icon file paths of the recently closed links, indexed by tab url. |
84 // protected by the list_lock_. | 84 // Holding a copy of recently_closed_icons_ initially, it's updated by the |
85 ShellLinkItemList most_visited_pages_; | 85 // JumpList update run. If the update run succeeds, it overwrites |
86 // recently_closed_icons_. | |
87 URLIconCache recently_closed_icons_in_update; | |
86 | 88 |
87 // Items in the "Recently Closed" category of the application JumpList, | 89 // A flag indicating if a JumpList update run is successful. |
88 // protected by the list_lock_. | 90 bool update_success_ = true; |
grt (UTC plus 2)
2017/06/09 10:42:58
initialize to false and set it to true in the one
chengx
2017/06/10 05:56:18
Done.
| |
89 ShellLinkItemList recently_closed_pages_; | |
90 | 91 |
91 // A boolean flag indicating if "Most Visited" category of the JumpList | 92 // A flag indicating if there is a timeout in notifying the JumpList update |
92 // has new updates therefore its icons need to be updated. | 93 // to shell. Note that this variable is independent of update_success_. |
93 // By default, this flag is set to false. If there's any change in | 94 bool update_timeout_ = false; |
94 // TabRestoreService, this flag will be set to true. | |
95 bool most_visited_pages_have_updates_ = false; | |
96 | |
97 // A boolean flag indicating if "Recently Closed" category of the JumpList | |
98 // has new updates therefore its icons need to be updated. | |
99 // By default, this flag is set to false. If there's any change in TopSites | |
100 // service, this flag will be set to true. | |
101 bool recently_closed_pages_have_updates_ = false; | |
102 }; | 95 }; |
103 | 96 |
104 // Observer callback for TabRestoreService::Observer to notify when a tab is | 97 // Observer callback for TabRestoreService::Observer to notify when a tab is |
grt (UTC plus 2)
2017/06/09 10:42:57
nit: remove the comments on these two overrides. t
grt (UTC plus 2)
2017/06/09 10:42:58
nit: move these overrides down into the private: s
chengx
2017/06/10 05:56:18
Done with moving the TopSitesObserver overrides to
chengx
2017/06/10 05:56:19
Done. Comments updated.
| |
105 // added or removed. | 98 // added or removed. |
106 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; | 99 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; |
107 | 100 |
108 // Observer callback to notice when our associated TabRestoreService | 101 // Observer callback to notice when our associated TabRestoreService |
109 // is destroyed. | 102 // is destroyed. |
110 void TabRestoreServiceDestroyed( | 103 void TabRestoreServiceDestroyed( |
111 sessions::TabRestoreService* service) override; | 104 sessions::TabRestoreService* service) override; |
112 | 105 |
113 // Cancel a pending jumplist update. | 106 // Cancel a pending JumpList update. |
114 void CancelPendingUpdate(); | 107 void CancelPendingUpdate(); |
grt (UTC plus 2)
2017/06/09 10:42:58
this should be private:
chengx
2017/06/10 05:56:18
Done.
| |
115 | 108 |
116 // Terminate the jumplist: cancel any pending updates and stop observing | 109 // Terminate the JumpList: cancel any pending updates and stop observing |
117 // the Profile and its services. This must be called before the |profile_| | 110 // the Profile and its services. This must be called before the |profile_| |
118 // is destroyed. | 111 // is destroyed. |
119 void Terminate(); | 112 void Terminate(); |
grt (UTC plus 2)
2017/06/09 10:42:57
private as well
chengx
2017/06/10 05:56:18
Done.
| |
120 | 113 |
121 // RefcountedKeyedService: | 114 // RefcountedKeyedService: |
122 void ShutdownOnUIThread() override; | 115 void ShutdownOnUIThread() override; |
123 | 116 |
124 // Returns true if the custom JumpList is enabled. | 117 // Returns true if the custom JumpList is enabled. |
125 static bool Enabled(); | 118 static bool Enabled(); |
126 | 119 |
127 private: | 120 private: |
128 friend JumpListFactory; | 121 friend JumpListFactory; |
129 explicit JumpList(Profile* profile); // Use JumpListFactory instead | 122 explicit JumpList(Profile* profile); // Use JumpListFactory instead |
130 ~JumpList() override; | 123 ~JumpList() override; |
131 | 124 |
132 enum class JumpListCategory { kMostVisited, kRecentlyClosed }; | 125 // Adds a new ShellLinkItem for |tab| to the JumpList data provided that doing |
126 // so will not exceed |max_items|. | |
127 bool AddTab(const sessions::TabRestoreService::Tab& tab, size_t max_items); | |
133 | 128 |
134 // Adds a new ShellLinkItem for |tab| to |data| provided that doing so will | 129 // Adds a new ShellLinkItem for each tab in |window| to the JumpList data |
135 // not exceed |max_items|. | 130 // provided that doing so will not exceed |max_items|. |
136 bool AddTab(const sessions::TabRestoreService::Tab& tab, | |
137 size_t max_items, | |
138 JumpListData* data); | |
139 | |
140 // Adds a new ShellLinkItem for each tab in |window| to |data| provided that | |
141 // doing so will not exceed |max_items|. | |
142 void AddWindow(const sessions::TabRestoreService::Window& window, | 131 void AddWindow(const sessions::TabRestoreService::Window& window, |
143 size_t max_items, | 132 size_t max_items); |
144 JumpListData* data); | |
145 | 133 |
146 // Starts loading a favicon for each URL in |icon_urls_|. | 134 // Starts loading a favicon for each URL in |icon_urls_|. |
147 // This function sends a query to HistoryService. | 135 // This function sends a query to HistoryService. |
148 // When finishing loading all favicons, this function posts a task that | 136 // When finishing loading all favicons, this function posts a task that |
149 // decompresses collected favicons and updates a JumpList. | 137 // decompresses collected favicons and updates a JumpList. |
150 void StartLoadingFavicon(); | 138 void StartLoadingFavicon(); |
151 | 139 |
152 // A callback function for HistoryService that notify when a requested favicon | 140 // Callback for HistoryService that notifies when a requested favicon is |
153 // is available. | 141 // available. To avoid file operations, this function just attaches the given |
154 // To avoid file operations, this function just attaches the given data to | 142 // data to a ShellLinkItem object. |
155 // a ShellLinkItem object. | |
156 void OnFaviconDataAvailable( | 143 void OnFaviconDataAvailable( |
157 const favicon_base::FaviconImageResult& image_result); | 144 const favicon_base::FaviconImageResult& image_result); |
158 | 145 |
159 // Callback for TopSites that notifies when the "Most Visited" list is | 146 // Callback for TopSites that notifies when the "Most Visited" list is |
160 // available. This function updates the ShellLinkItemList objects and | 147 // available. This function updates the ShellLinkItemList objects and |
161 // begins the process of fetching favicons for the URLs. | 148 // begins the process of fetching favicons for the URLs. |
162 void OnMostVisitedURLsAvailable( | 149 void OnMostVisitedURLsAvailable( |
163 const history::MostVisitedURLList& data); | 150 const history::MostVisitedURLList& data); |
164 | 151 |
165 // Callback for changes to the incognito mode availability pref. | 152 // Callback for changes to the incognito mode availability pref. |
166 void OnIncognitoAvailabilityChanged(); | 153 void OnIncognitoAvailabilityChanged(); |
167 | 154 |
168 // Posts tasks to update the JumpList and delete any obsolete JumpList related | 155 // Posts tasks to update the JumpList and delete any obsolete JumpList related |
grt (UTC plus 2)
2017/06/09 10:42:58
nit: move this down below DeferredTabRestoreServic
chengx
2017/06/10 05:56:18
Sure. I moved some but in this header file. I thin
grt (UTC plus 2)
2017/06/12 07:15:32
Good plan.
chengx
2017/06/12 22:05:28
Acknowledged.
| |
169 // folders. | 156 // folders. |
170 void PostRunUpdate(); | 157 void PostRunUpdate(); |
171 | 158 |
172 // history::TopSitesObserver implementation. | 159 // history::TopSitesObserver implementation. |
173 void TopSitesLoaded(history::TopSites* top_sites) override; | 160 void TopSitesLoaded(history::TopSites* top_sites) override; |
174 void TopSitesChanged(history::TopSites* top_sites, | 161 void TopSitesChanged(history::TopSites* top_sites, |
175 ChangeReason change_reason) override; | 162 ChangeReason change_reason) override; |
176 | 163 |
177 // Called on a timer to update the most visited URLs after requests storms | 164 // Called on a timer after requests storms have subsided. Calls APIs |
178 // have subsided. | 165 // DeferredTop{SitesChanged, ServiceChanged} on demand to do the actual work. |
166 void DeferredChanged(); | |
grt (UTC plus 2)
2017/06/09 10:42:58
nit: i think this should either be named after whe
chengx
2017/06/10 05:56:18
I'll go with OnDelayTimer.
| |
167 | |
168 // Update the most visited URLs, called in DeferredChanged(). | |
grt (UTC plus 2)
2017/06/09 10:42:58
i don't think it's necessary to document who calls
chengx
2017/06/10 05:56:18
I've updated the comments.
| |
179 void DeferredTopSitesChanged(); | 169 void DeferredTopSitesChanged(); |
grt (UTC plus 2)
2017/06/09 10:42:58
since the "deferred" part is now taken care of by
chengx
2017/06/10 05:56:18
Renamed to ProcessTopSitesNotification
| |
180 | 170 |
181 // Called on a timer to update the "Recently Closed" category of JumpList | 171 // Update the recently closed URLs, called in DeferredChanged(). |
182 // after requests storms have subsided. | |
183 void DeferredTabRestoreServiceChanged(); | 172 void DeferredTabRestoreServiceChanged(); |
grt (UTC plus 2)
2017/06/09 10:42:58
ProcessTabRestoreServiceNotification?
chengx
2017/06/10 05:56:18
SGTM. I've renamed the variable.
| |
184 | 173 |
185 // Deletes icon files of |category| in |icon_dir| which are not in the cache | 174 // Deletes icon files in |icon_dir| which are not in |icon_cache| anymore. |
186 // anymore. | 175 static void DeleteIconFiles(const base::FilePath& icon_dir, |
187 void DeleteIconFiles(const base::FilePath& icon_dir, | 176 URLIconCache* icon_cache); |
188 JumpListCategory category); | |
189 | 177 |
190 // Creates at most |max_items| icon files of |category| in |icon_dir| for the | 178 // In |icon_dir|, creates at most |max_items| icon files which are not in |
191 // asynchrounously loaded icons stored in |item_list|. | 179 // |icon_cache| for the asynchrounously loaded icons stored in |item_list|. |
180 // |icon_cache| is also updated for newly created icons. | |
192 // Returns the number of new icon files created. | 181 // Returns the number of new icon files created. |
193 int CreateIconFiles(const base::FilePath& icon_dir, | 182 static int CreateIconFiles(const base::FilePath& icon_dir, |
194 const ShellLinkItemList& item_list, | 183 const ShellLinkItemList& item_list, |
195 size_t max_items, | 184 size_t max_items, |
196 JumpListCategory category); | 185 URLIconCache* icon_cache); |
197 | 186 |
198 // Updates icon files in |icon_dir|, which includes deleting old icons and | 187 // Updates icon files for |page_list| in |icon_dir|, which consists of |
199 // creating at most |slot_limit| new icons for |page_list|. | 188 // 1) creating at most |slot_limit| new icons which are not in |icon_cache|; |
189 // 2) deleting old icons which are not in |icon_cache|. | |
200 // Returns the number of new icon files created. | 190 // Returns the number of new icon files created. |
201 int UpdateIconFiles(const base::FilePath& icon_dir, | 191 static int UpdateIconFiles(const base::FilePath& icon_dir, |
202 const ShellLinkItemList& page_list, | 192 const ShellLinkItemList& page_list, |
203 size_t slot_limit, | 193 size_t slot_limit, |
204 JumpListCategory category); | 194 URLIconCache* icon_cache); |
205 | 195 |
206 // Updates the jumplist, once all the data has been fetched. This method calls | 196 // Updates the application JumpList, which consists of 1) create new icon |
207 // UpdateJumpList() to do most of the work. | 197 // files; 2) delete obsolete icon files; 3) notify the OS. |
208 void RunUpdateJumpList( | 198 // Note that any timeout error along the way results in the old JumpList being |
209 IncognitoModePrefs::Availability incognito_availability, | 199 // left as-is, while any non-timeout error results in the old JumpList being |
200 // left as-is, but without icon files. | |
201 static void RunUpdateJumpList( | |
210 const base::string16& app_id, | 202 const base::string16& app_id, |
211 const base::FilePath& profile_dir, | 203 const base::FilePath& profile_dir, |
212 base::RefCountedData<JumpListData>* ref_counted_data); | 204 const ShellLinkItemList& most_visited_pages, |
205 const ShellLinkItemList& recently_closed_pages, | |
206 bool most_visited_pages_have_updates, | |
207 bool recently_closed_pages_have_updates, | |
208 IncognitoModePrefs::Availability incognito_availability, | |
209 JumpListUpdateResults* update_results); | |
213 | 210 |
214 // Updates the application JumpList, which consists of 1) delete old icon | 211 // Callback for RunUpdateJumpList that notifies when it finishes running. |
215 // files; 2) create new icon files; 3) notify the OS. This method is called | 212 // Updates certain JumpList member variables and/or triggers a new JumpList |
216 // from RunUpdateJumpList(). | 213 // update based on |update_results|. |
217 // Note that any timeout error along the way results in the old jumplist being | 214 void OnRunUpdateCompletion( |
218 // left as-is, while any non-timeout error results in the old jumplist being | 215 std::unique_ptr<JumpListUpdateResults> update_results); |
219 // left as-is, but without icon files. | |
220 bool UpdateJumpList(const base::string16& app_id, | |
221 const base::FilePath& profile_dir, | |
222 const ShellLinkItemList& most_visited_pages, | |
223 const ShellLinkItemList& recently_closed_pages, | |
224 bool most_visited_pages_have_updates, | |
225 bool recently_closed_pages_have_updates, | |
226 IncognitoModePrefs::Availability incognito_availability); | |
227 | 216 |
228 // Tracks FaviconService tasks. | 217 // Tracks FaviconService tasks. |
229 base::CancelableTaskTracker cancelable_task_tracker_; | 218 base::CancelableTaskTracker cancelable_task_tracker_; |
230 | 219 |
231 // The Profile object is used to listen for events. | 220 // The Profile object is used to listen for events. |
232 Profile* profile_; | 221 Profile* profile_; |
233 | 222 |
234 // Lives on the UI thread. | 223 // Lives on the UI thread. |
grt (UTC plus 2)
2017/06/09 10:42:58
all members live on the UI thread now, so this com
chengx
2017/06/10 05:56:18
Done.
| |
235 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; | 224 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
236 | 225 |
237 // App id to associate with the jump list. | 226 // App id to associate with the JumpList. |
238 base::string16 app_id_; | 227 base::string16 app_id_; |
239 | 228 |
240 // Timer for requesting delayed updates of the "Most Visited" category of | 229 // Timer for requesting delayed JumpList updates. |
241 // jumplist. | 230 base::OneShotTimer timer_; |
242 base::OneShotTimer timer_most_visited_; | |
243 | 231 |
244 // Timer for requesting delayed updates of the "Recently Closed" category of | 232 // A list of URLs we need to retrieve their favicons, |
245 // jumplist. | 233 typedef std::pair<std::string, scoped_refptr<ShellLinkItem>> URLPair; |
grt (UTC plus 2)
2017/06/09 10:42:57
wdyt of:
using UrlAndLinkItem = ...
chengx
2017/06/10 05:56:18
Done.
| |
246 base::OneShotTimer timer_recently_closed_; | 234 std::list<URLPair> icon_urls_; |
235 | |
236 // Items in the "Most Visited" category of the JumpList. | |
237 ShellLinkItemList most_visited_pages_; | |
238 | |
239 // Items in the "Recently Closed" category of the JumpList. | |
240 ShellLinkItemList recently_closed_pages_; | |
241 | |
242 // The icon file paths of the most visited links, indexed by tab url. | |
243 URLIconCache most_visited_icons_; | |
244 | |
245 // The icon file paths of the recently closed links, indexed by tab url. | |
246 URLIconCache recently_closed_icons_; | |
247 | |
248 // A flag indicating if "Most Visited" category has pending notifications. | |
249 bool most_visited_has_pending_notification_ = false; | |
250 | |
251 // A flag indicating if "Recently Closed" category has pending notifications. | |
252 bool recently_closed_has_pending_notification_ = false; | |
253 | |
254 // A flag indicating if "Most Visited" category has new updates. | |
255 bool most_visited_pages_have_updates_ = false; | |
256 | |
257 // A flag indicating if "Recently Closed" category has new updates. | |
258 bool recently_closed_pages_have_updates_ = false; | |
259 | |
260 // A boolean flag indicating if there's a JumpList update task already posted | |
261 // or currently running. | |
262 bool update_in_progress_ = false; | |
263 | |
264 // A boolean flag indicating if a session has at least one tab closed. | |
265 bool has_tab_closed_ = false; | |
247 | 266 |
248 // Number of updates to skip to alleviate the machine when a previous update | 267 // Number of updates to skip to alleviate the machine when a previous update |
249 // was too slow. Updates will be resumed when this reaches 0 again. | 268 // was too slow. Updates will be resumed when this reaches 0 again. |
250 int updates_to_skip_ = 0; | 269 int updates_to_skip_ = 0; |
251 | 270 |
252 // A boolean flag indicating if a session has at least one tab closed. | |
253 bool has_tab_closed_ = false; | |
254 | |
255 // Holds data that can be accessed from multiple threads. | |
256 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; | |
257 | |
258 // The icon file paths of the most visited links and the recently closed links | |
259 // in the current jumplist, indexed by tab url, respectively. | |
260 // They may only be accessed on update_jumplist_task_runner_. | |
261 base::flat_map<std::string, base::FilePath> most_visited_icons_; | |
262 base::flat_map<std::string, base::FilePath> recently_closed_icons_; | |
263 | |
264 // Id of last favicon task. It's used to cancel current task if a new one | 271 // Id of last favicon task. It's used to cancel current task if a new one |
265 // comes in before it finishes. | 272 // comes in before it finishes. |
266 base::CancelableTaskTracker::TaskId task_id_; | 273 base::CancelableTaskTracker::TaskId task_id_; |
grt (UTC plus 2)
2017/06/09 10:42:58
= base::CancelableTaskTracker::kBadTaskId
and remo
chengx
2017/06/10 05:56:18
Done.
| |
267 | 274 |
268 // A task runner running tasks to update the JumpList. | 275 // A task runner running tasks to update the JumpList. |
269 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; | 276 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; |
270 | 277 |
271 // A task runner running tasks to delete JumpListIcons directory and | 278 // A task runner running tasks to delete JumpListIcons directory and |
272 // JumpListIconsOld directory. | 279 // JumpListIconsOld directory. |
273 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; | 280 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; |
274 | 281 |
275 SEQUENCE_CHECKER(sequence_checker_); | 282 SEQUENCE_CHECKER(sequence_checker_); |
276 | 283 |
277 // For callbacks may be run after destruction. | 284 // For callbacks may run after destruction. |
278 base::WeakPtrFactory<JumpList> weak_ptr_factory_; | 285 base::WeakPtrFactory<JumpList> weak_ptr_factory_; |
279 | 286 |
280 DISALLOW_COPY_AND_ASSIGN(JumpList); | 287 DISALLOW_COPY_AND_ASSIGN(JumpList); |
281 }; | 288 }; |
282 | 289 |
283 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ | 290 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ |
OLD | NEW |