| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 // Returns true if the custom JumpList is enabled. | 109 // Returns true if the custom JumpList is enabled. |
| 110 // The custom jumplist works only on Windows 7 and above. | 110 // The custom jumplist works only on Windows 7 and above. |
| 111 static bool Enabled(); | 111 static bool Enabled(); |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 friend JumpListFactory; | 114 friend JumpListFactory; |
| 115 explicit JumpList(Profile* profile); // Use JumpListFactory instead | 115 explicit JumpList(Profile* profile); // Use JumpListFactory instead |
| 116 ~JumpList() override; | 116 ~JumpList() override; |
| 117 | 117 |
| 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 | 118 // These functions are copied from the RecentlyClosedTabsHandler class for |
| 121 // compatibility with the new-tab page. | 119 // compatibility with the new-tab page. |
| 120 // AddTab creates a ShellLinkItem object from a tab and add it to |data|. |
| 122 bool AddTab(const sessions::TabRestoreService::Tab& tab, | 121 bool AddTab(const sessions::TabRestoreService::Tab& tab, |
| 123 ShellLinkItemList* list, | 122 JumpListData* data, |
| 124 size_t max_items); | 123 size_t max_items); |
| 124 // Creates a ShellLinkItem object for each tab in the given |window| and add |
| 125 // to |data|. |
| 125 void AddWindow(const sessions::TabRestoreService::Window& window, | 126 void AddWindow(const sessions::TabRestoreService::Window& window, |
| 126 ShellLinkItemList* list, | 127 JumpListData* data, |
| 127 size_t max_items); | 128 size_t max_items); |
| 128 | 129 |
| 129 // Starts loading a favicon for each URL in |icon_urls_|. | 130 // Starts loading a favicon for each URL in |icon_urls_|. |
| 130 // This function sends a query to HistoryService. | 131 // This function sends a query to HistoryService. |
| 131 // When finishing loading all favicons, this function posts a task that | 132 // When finishing loading all favicons, this function posts a task that |
| 132 // decompresses collected favicons and updates a JumpList. | 133 // decompresses collected favicons and updates a JumpList. |
| 133 void StartLoadingFavicon(); | 134 void StartLoadingFavicon(); |
| 134 | 135 |
| 135 // A callback function for HistoryService that notify when a requested favicon | 136 // A callback function for HistoryService that notify when a requested favicon |
| 136 // is available. | 137 // is available. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 170 |
| 170 // Lives on the UI thread. | 171 // Lives on the UI thread. |
| 171 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; | 172 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| 172 | 173 |
| 173 // App id to associate with the jump list. | 174 // App id to associate with the jump list. |
| 174 std::wstring app_id_; | 175 std::wstring app_id_; |
| 175 | 176 |
| 176 // The directory which contains JumpList icons. | 177 // The directory which contains JumpList icons. |
| 177 base::FilePath icon_dir_; | 178 base::FilePath icon_dir_; |
| 178 | 179 |
| 180 // A boolean flag indicating if "Most Visited" category of the JumpList should |
| 181 // be updated or not. |
| 182 bool should_update_most_visited_; |
| 183 |
| 184 // A boolean flag indicating if "Recently Closed" category of the JumpList |
| 185 // should be updated or not. |
| 186 bool should_update_recent_closed_; |
| 187 |
| 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 |