Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/win/jumplist.h

Issue 2836873003: Update different JumpList categories on demand (Closed)
Patch Set: Fix nits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/win/jumplist.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // By default, this flag is set to false. If there's any change in
91 // TabRestoreService, this flag will be set to true.
92 bool most_visited_pages_have_updates_ = false;
93
94 // A boolean flag indicating if "Recently Closed" category of the JumpList
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
97 // service, this flag will be set to true.
98 bool recently_closed_pages_have_updates_ = false;
87 }; 99 };
88 100
89 // Observer callback for TabRestoreService::Observer to notify when a tab is 101 // Observer callback for TabRestoreService::Observer to notify when a tab is
90 // added or removed. 102 // added or removed.
91 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override; 103 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override;
92 104
93 // Observer callback to notice when our associated TabRestoreService 105 // Observer callback to notice when our associated TabRestoreService
94 // is destroyed. 106 // is destroyed.
95 void TabRestoreServiceDestroyed( 107 void TabRestoreServiceDestroyed(
96 sessions::TabRestoreService* service) override; 108 sessions::TabRestoreService* service) override;
(...skipping 11 matching lines...) Expand all
108 120
109 // Returns true if the custom JumpList is enabled. 121 // Returns true if the custom JumpList is enabled.
110 // The custom jumplist works only on Windows 7 and above. 122 // The custom jumplist works only on Windows 7 and above.
111 static bool Enabled(); 123 static bool Enabled();
112 124
113 private: 125 private:
114 friend JumpListFactory; 126 friend JumpListFactory;
115 explicit JumpList(Profile* profile); // Use JumpListFactory instead 127 explicit JumpList(Profile* profile); // Use JumpListFactory instead
116 ~JumpList() override; 128 ~JumpList() override;
117 129
118 // Creates a ShellLinkItem object from a tab (or a window) and add it to the 130 // The AddTab and AddWindow functions are copied from the
119 // given list. 131 // RecentlyClosedTabsHandler class for compatibility with the new-tab page.
120 // These functions are copied from the RecentlyClosedTabsHandler class for 132
121 // compatibility with the new-tab page. 133 // Adds a new ShellLinkItem for |tab| to |data| provided that doing so will
134 // not exceed |max_items|.
122 bool AddTab(const sessions::TabRestoreService::Tab& tab, 135 bool AddTab(const sessions::TabRestoreService::Tab& tab,
123 ShellLinkItemList* list, 136 size_t max_items,
124 size_t max_items); 137 JumpListData* data);
138
139 // Adds a new ShellLinkItem for each tab in |window| to |data| provided that
140 // doing so will not exceed |max_items|.
125 void AddWindow(const sessions::TabRestoreService::Window& window, 141 void AddWindow(const sessions::TabRestoreService::Window& window,
126 ShellLinkItemList* list, 142 size_t max_items,
127 size_t max_items); 143 JumpListData* data);
128 144
129 // Starts loading a favicon for each URL in |icon_urls_|. 145 // Starts loading a favicon for each URL in |icon_urls_|.
130 // This function sends a query to HistoryService. 146 // This function sends a query to HistoryService.
131 // When finishing loading all favicons, this function posts a task that 147 // When finishing loading all favicons, this function posts a task that
132 // decompresses collected favicons and updates a JumpList. 148 // decompresses collected favicons and updates a JumpList.
133 void StartLoadingFavicon(); 149 void StartLoadingFavicon();
134 150
135 // A callback function for HistoryService that notify when a requested favicon 151 // A callback function for HistoryService that notify when a requested favicon
136 // is available. 152 // is available.
137 // To avoid file operations, this function just attaches the given data to 153 // To avoid file operations, this function just attaches the given data to
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Timer for requesting delayed updates of the jumplist. 195 // Timer for requesting delayed updates of the jumplist.
180 base::OneShotTimer timer_; 196 base::OneShotTimer timer_;
181 197
182 // Holds data that can be accessed from multiple threads. 198 // Holds data that can be accessed from multiple threads.
183 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_; 199 scoped_refptr<base::RefCountedData<JumpListData>> jumplist_data_;
184 200
185 // Id of last favicon task. It's used to cancel current task if a new one 201 // Id of last favicon task. It's used to cancel current task if a new one
186 // comes in before it finishes. 202 // comes in before it finishes.
187 base::CancelableTaskTracker::TaskId task_id_; 203 base::CancelableTaskTracker::TaskId task_id_;
188 204
189 // A task runner running tasks to update the jumplist in JumpListIcons. 205 // A task runner running tasks to update the JumpList.
190 scoped_refptr<base::SingleThreadTaskRunner> update_jumplisticons_task_runner_; 206 scoped_refptr<base::SingleThreadTaskRunner> update_jumplist_task_runner_;
191 207
192 // A task runner running tasks to delete JumpListIconsOld directory. 208 // A task runner running tasks to delete JumpListIcons directory and
193 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticonsold_task_runner_; 209 // JumpListIconsOld directory.
210 scoped_refptr<base::SequencedTaskRunner> delete_jumplisticons_task_runner_;
194 211
195 // For callbacks may be run after destruction. 212 // For callbacks may be run after destruction.
196 base::WeakPtrFactory<JumpList> weak_ptr_factory_; 213 base::WeakPtrFactory<JumpList> weak_ptr_factory_;
197 214
198 DISALLOW_COPY_AND_ASSIGN(JumpList); 215 DISALLOW_COPY_AND_ASSIGN(JumpList);
199 }; 216 };
200 217
201 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_ 218 #endif // CHROME_BROWSER_WIN_JUMPLIST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/win/jumplist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698