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

Side by Side Diff: chrome/browser/jumplist_win.h

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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_JUMPLIST_WIN_H_ 5 #ifndef CHROME_BROWSER_JUMPLIST_WIN_H_
6 #define CHROME_BROWSER_JUMPLIST_WIN_H_ 6 #define CHROME_BROWSER_JUMPLIST_WIN_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // need it. 44 // need it.
45 class ShellLinkItem : public base::RefCountedThreadSafe<ShellLinkItem> { 45 class ShellLinkItem : public base::RefCountedThreadSafe<ShellLinkItem> {
46 public: 46 public:
47 ShellLinkItem() : index_(0), favicon_(false) { 47 ShellLinkItem() : index_(0), favicon_(false) {
48 } 48 }
49 49
50 const std::wstring& arguments() const { return arguments_; } 50 const std::wstring& arguments() const { return arguments_; }
51 const std::wstring& title() const { return title_; } 51 const std::wstring& title() const { return title_; }
52 const std::wstring& icon() const { return icon_; } 52 const std::wstring& icon() const { return icon_; }
53 int index() const { return index_; } 53 int index() const { return index_; }
54 scoped_refptr<base::RefCountedMemory> data() const { return data_; } 54 SkBitmap data() const { return data_; }
sky 2012/08/27 14:52:01 const SkBitmap&
55 55
56 void SetArguments(const std::wstring& arguments) { 56 void SetArguments(const std::wstring& arguments) {
57 arguments_ = arguments; 57 arguments_ = arguments;
58 } 58 }
59 59
60 void SetTitle(const std::wstring& title) { 60 void SetTitle(const std::wstring& title) {
61 title_ = title; 61 title_ = title;
62 } 62 }
63 63
64 void SetIcon(const std::wstring& icon, int index, bool favicon) { 64 void SetIcon(const std::wstring& icon, int index, bool favicon) {
65 icon_ = icon; 65 icon_ = icon;
66 index_ = index; 66 index_ = index;
67 favicon_ = favicon; 67 favicon_ = favicon;
68 } 68 }
69 69
70 void SetIconData(scoped_refptr<base::RefCountedMemory> data) { 70 void SetIconData(const SkBitmap& data) {
71 data_ = data; 71 data_ = data;
72 } 72 }
73 73
74 private: 74 private:
75 friend class base::RefCountedThreadSafe<ShellLinkItem>; 75 friend class base::RefCountedThreadSafe<ShellLinkItem>;
76 76
77 ~ShellLinkItem() {} 77 ~ShellLinkItem() {}
78 78
79 std::wstring arguments_; 79 std::wstring arguments_;
80 std::wstring title_; 80 std::wstring title_;
81 std::wstring icon_; 81 std::wstring icon_;
82 scoped_refptr<base::RefCountedMemory> data_; 82 SkBitmap data_;
83 int index_; 83 int index_;
84 bool favicon_; 84 bool favicon_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(ShellLinkItem); 86 DISALLOW_COPY_AND_ASSIGN(ShellLinkItem);
87 }; 87 };
88 88
89 typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList; 89 typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList;
90 90
91 // A class which implements an application JumpList. 91 // A class which implements an application JumpList.
92 // This class encapsulates operations required for updating an application 92 // This class encapsulates operations required for updating an application
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // that retrieves a favicon for each URL in the list. 169 // that retrieves a favicon for each URL in the list.
170 void OnSegmentUsageAvailable(CancelableRequestProvider::Handle handle, 170 void OnSegmentUsageAvailable(CancelableRequestProvider::Handle handle,
171 std::vector<PageUsageData*>* data); 171 std::vector<PageUsageData*>* data);
172 172
173 // A callback function for HistoryService that notify when a requested favicon 173 // A callback function for HistoryService that notify when a requested favicon
174 // is available. 174 // is available.
175 // To avoid file operations, this function just attaches the given data to 175 // To avoid file operations, this function just attaches the given data to
176 // a ShellLinkItem object. 176 // a ShellLinkItem object.
177 // When finishing loading all favicons, this function posts a task that 177 // When finishing loading all favicons, this function posts a task that
178 // decompresses collected favicons and updates a JumpList. 178 // decompresses collected favicons and updates a JumpList.
179 void OnFaviconDataAvailable(HistoryService::Handle handle, 179 void OnFaviconDataAvailable(
180 history::FaviconData favicon); 180 HistoryService::Handle handle,
181 const history::FaviconImageResult& image_result);
181 182
182 // Callback for TopSites that notifies when the "Most 183 // Callback for TopSites that notifies when the "Most
183 // Visited" list is available. This function updates the ShellLinkItemList 184 // Visited" list is available. This function updates the ShellLinkItemList
184 // objects and send another query that retrieves a favicon for each URL in 185 // objects and send another query that retrieves a favicon for each URL in
185 // the list. 186 // the list.
186 void OnMostVisitedURLsAvailable( 187 void OnMostVisitedURLsAvailable(
187 const history::MostVisitedURLList& data); 188 const history::MostVisitedURLList& data);
188 189
189 // Runnable method that updates the jumplist, once all the data 190 // Runnable method that updates the jumplist, once all the data
190 // has been fetched. 191 // has been fetched.
191 void RunUpdate(); 192 void RunUpdate();
192 193
193 // Helper method for RunUpdate to decode the data about the asynchrounously 194 // Helper method for RunUpdate to create icon files for the asynchrounously
194 // loaded icons. 195 // loaded icons.
195 void DecodeIconData(const ShellLinkItemList& item_list); 196 void CreateIconFiles(const ShellLinkItemList& item_list);
196 197
197 private: 198 private:
198 friend class base::RefCountedThreadSafe<JumpList>; 199 friend class base::RefCountedThreadSafe<JumpList>;
199 ~JumpList(); 200 ~JumpList();
200 201
201 // Our consumers for HistoryService. 202 // Our consumers for HistoryService.
202 CancelableRequestConsumer most_visited_consumer_; 203 CancelableRequestConsumer most_visited_consumer_;
203 CancelableRequestConsumer favicon_consumer_; 204 CancelableRequestConsumer favicon_consumer_;
204 CancelableRequestConsumer topsites_consumer_; 205 CancelableRequestConsumer topsites_consumer_;
205 206
(...skipping 25 matching lines...) Expand all
231 // Handle of last favicon request used to cancel if a new request 232 // Handle of last favicon request used to cancel if a new request
232 // comes in before the current one returns. 233 // comes in before the current one returns.
233 FaviconService::Handle handle_; 234 FaviconService::Handle handle_;
234 235
235 // Lock for most_visited_pages_, recently_closed_pages_, icon_urls_ 236 // Lock for most_visited_pages_, recently_closed_pages_, icon_urls_
236 // as they may be used by up to 3 threads. 237 // as they may be used by up to 3 threads.
237 base::Lock list_lock_; 238 base::Lock list_lock_;
238 }; 239 };
239 240
240 #endif // CHROME_BROWSER_JUMPLIST_WIN_H_ 241 #endif // CHROME_BROWSER_JUMPLIST_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698