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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 typedef std::pair<std::string, scoped_refptr<ShellLinkItem> > URLPair; | 77 typedef std::pair<std::string, scoped_refptr<ShellLinkItem> > URLPair; |
78 std::list<URLPair> icon_urls_; | 78 std::list<URLPair> icon_urls_; |
79 | 79 |
80 // Items in the "Most Visited" category of the application JumpList, | 80 // Items in the "Most Visited" category of the application JumpList, |
81 // protected by the list_lock_. | 81 // protected by the list_lock_. |
82 ShellLinkItemList most_visited_pages_; | 82 ShellLinkItemList most_visited_pages_; |
83 | 83 |
84 // Items in the "Recently Closed" category of the application JumpList, | 84 // Items in the "Recently Closed" category of the application JumpList, |
85 // protected by the list_lock_. | 85 // protected by the list_lock_. |
86 ShellLinkItemList recently_closed_pages_; | 86 ShellLinkItemList recently_closed_pages_; |
87 | |
88 // A boolean flag indicating if "Most Visited" category of the JumpList | |
89 // has new updates therefore its icons need to be updated. | |
90 bool most_visited_pages_have_updates_; | |
91 | |
92 // A boolean flag indicating if "Recently Closed" category of the JumpList | |
93 // has new updates therefore its icons need to be updated. | |
94 bool recently_closed_pages_have_updates_; | |
87 }; | 95 }; |
88 | 96 |
89 // Observer callback for TabRestoreService::Observer to notify when a tab is | 97 // Observer callback for TabRestoreService::Observer to notify when a tab is |
90 // added or removed. | 98 // added or removed. |
91 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; | 99 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; |
92 | 100 |
93 // Observer callback to notice when our associated TabRestoreService | 101 // Observer callback to notice when our associated TabRestoreService |
94 // is destroyed. | 102 // is destroyed. |
95 void TabRestoreServiceDestroyed( | 103 void TabRestoreServiceDestroyed( |
96 sessions::TabRestoreService* service) override; | 104 sessions::TabRestoreService* service) override; |
(...skipping 11 matching lines...) Expand all Loading... | |
108 | 116 |
109 // Returns true if the custom JumpList is enabled. | 117 // Returns true if the custom JumpList is enabled. |
110 // The custom jumplist works only on Windows 7 and above. | 118 // The custom jumplist works only on Windows 7 and above. |
111 static bool Enabled(); | 119 static bool Enabled(); |
112 | 120 |
113 private: | 121 private: |
114 friend JumpListFactory; | 122 friend JumpListFactory; |
115 explicit JumpList(Profile* profile); // Use JumpListFactory instead | 123 explicit JumpList(Profile* profile); // Use JumpListFactory instead |
116 ~JumpList() override; | 124 ~JumpList() override; |
117 | 125 |
118 // Creates a ShellLinkItem object from a tab (or a window) and add it to the | |
119 // given list. | |
120 // These functions are copied from the RecentlyClosedTabsHandler class for | 126 // These functions are copied from the RecentlyClosedTabsHandler class for |
121 // compatibility with the new-tab page. | 127 // compatibility with the new-tab page. |
128 // AddTab creates a ShellLinkItem object from a tab and add it to |data|. | |
grt (UTC plus 2)
2017/04/27 09:05:25
better yet:
// Adds a new ShellLinkItem for |tab
grt (UTC plus 2)
2017/04/27 09:05:25
nit: add -> adds
grt (UTC plus 2)
2017/04/27 09:05:25
nit: "Creates a ShellLinkItem..."
chengx
2017/04/27 17:21:11
Done.
chengx
2017/04/27 17:21:11
Done.
chengx
2017/04/27 17:21:11
Done.
| |
122 bool AddTab(const sessions::TabRestoreService::Tab& tab, | 129 bool AddTab(const sessions::TabRestoreService::Tab& tab, |
123 ShellLinkItemList* list, | 130 JumpListData* data, |
grt (UTC plus 2)
2017/04/27 09:05:25
nit: out params must follow all in params (https:/
chengx
2017/04/27 17:21:11
Done. Thanks for pointing me to this.
| |
124 size_t max_items); | 131 size_t max_items); |
132 // Creates a ShellLinkItem object for each tab in the given |window| and add | |
133 // to |data|. | |
125 void AddWindow(const sessions::TabRestoreService::Window& window, | 134 void AddWindow(const sessions::TabRestoreService::Window& window, |
126 ShellLinkItemList* list, | 135 JumpListData* data, |
127 size_t max_items); | 136 size_t max_items); |
128 | 137 |
129 // Starts loading a favicon for each URL in |icon_urls_|. | 138 // Starts loading a favicon for each URL in |icon_urls_|. |
130 // This function sends a query to HistoryService. | 139 // This function sends a query to HistoryService. |
131 // When finishing loading all favicons, this function posts a task that | 140 // When finishing loading all favicons, this function posts a task that |
132 // decompresses collected favicons and updates a JumpList. | 141 // decompresses collected favicons and updates a JumpList. |
133 void StartLoadingFavicon(); | 142 void StartLoadingFavicon(); |
134 | 143 |
135 // A callback function for HistoryService that notify when a requested favicon | 144 // A callback function for HistoryService that notify when a requested favicon |
136 // is available. | 145 // is available. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 // Timer for requesting delayed updates of the jumplist. | 188 // Timer for requesting delayed updates of the jumplist. |
180 base::OneShotTimer timer_; | 189 base::OneShotTimer timer_; |
181 | 190 |
182 // Holds data that can be accessed from multiple threads. | 191 // Holds data that can be accessed from multiple threads. |
183 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; | 192 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; |
184 | 193 |
185 // Id of last favicon task. It's used to cancel current task if a new one | 194 // Id of last favicon task. It's used to cancel current task if a new one |
186 // comes in before it finishes. | 195 // comes in before it finishes. |
187 base::CancelableTaskTracker::TaskId task_id_; | 196 base::CancelableTaskTracker::TaskId task_id_; |
188 | 197 |
189 // A task runner running tasks to update the jumplist in JumpListIcons. | 198 // A task runner running tasks to update the JumpList. |
190 scoped_refptr<base::SingleThreadTaskRunner> update_jumplisticons_task_runner_; | 199 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_; |
191 | 200 |
192 // A task runner running tasks to delete JumpListIconsOld directory. | 201 // A task runner running tasks to delete JumpListIcons directory and |
193 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticonsold_task_runner_; | 202 // JumpListIconsOld directory. |
203 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_; | |
194 | 204 |
195 // For callbacks may be run after destruction. | 205 // For callbacks may be run after destruction. |
196 base::WeakPtrFactory<JumpList> weak_ptr_factory_; | 206 base::WeakPtrFactory<JumpList> weak_ptr_factory_; |
197 | 207 |
198 DISALLOW_COPY_AND_ASSIGN(JumpList); | 208 DISALLOW_COPY_AND_ASSIGN(JumpList); |
199 }; | 209 }; |
200 | 210 |
201 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ | 211 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ |
OLD | NEW |