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

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

Issue 2859193005: Cache JumpList icons to avoid unnecessary creation and deletion (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 | « chrome/browser/win/jumplist_file_util_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_UPDATER_H_ 5 #ifndef CHROME_BROWSER_WIN_JUMPLIST_UPDATER_H_
6 #define CHROME_BROWSER_WIN_JUMPLIST_UPDATER_H_ 6 #define CHROME_BROWSER_WIN_JUMPLIST_UPDATER_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <shobjidl.h> 9 #include <shobjidl.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 10 matching lines...) Expand all
21 // Represents a class used for creating an IShellLink object. 21 // Represents a class used for creating an IShellLink object.
22 // Even though an IShellLink also needs the absolute path to an application to 22 // Even though an IShellLink also needs the absolute path to an application to
23 // be executed, this class does not have any variables for it because current 23 // be executed, this class does not have any variables for it because current
24 // users always use "chrome.exe" as the application. 24 // users always use "chrome.exe" as the application.
25 class ShellLinkItem : public base::RefCountedThreadSafe<ShellLinkItem> { 25 class ShellLinkItem : public base::RefCountedThreadSafe<ShellLinkItem> {
26 public: 26 public:
27 ShellLinkItem(); 27 ShellLinkItem();
28 28
29 const base::string16& title() const { return title_; } 29 const base::string16& title() const { return title_; }
30 const base::string16& icon_path() const { return icon_path_; } 30 const base::string16& icon_path() const { return icon_path_; }
31 const std::string& url() const { return url_; }
31 int icon_index() const { return icon_index_; } 32 int icon_index() const { return icon_index_; }
32 const gfx::ImageSkia& icon_image() const { return icon_image_; } 33 const gfx::ImageSkia& icon_image() const { return icon_image_; }
33 34
34 base::string16 GetArguments() const; 35 base::string16 GetArguments() const;
35 base::CommandLine* GetCommandLine(); 36 base::CommandLine* GetCommandLine();
36 37
37 void set_title(const base::string16& title) { title_ = title; } 38 void set_title(const base::string16& title) { title_ = title; }
38
39 void set_icon(const base::string16& path, int index) { 39 void set_icon(const base::string16& path, int index) {
40 icon_path_ = path; 40 icon_path_ = path;
41 icon_index_ = index; 41 icon_index_ = index;
42 } 42 }
43 void set_url(const std::string& url) { url_ = url; }
43 44
44 void set_icon_image(const gfx::ImageSkia& image) { 45 void set_icon_image(const gfx::ImageSkia& image) {
45 icon_image_ = image; 46 icon_image_ = image;
46 } 47 }
47 48
48 private: 49 private:
49 friend class base::RefCountedThreadSafe<ShellLinkItem>; 50 friend class base::RefCountedThreadSafe<ShellLinkItem>;
50 ~ShellLinkItem(); 51 ~ShellLinkItem();
51 52
52 // Used for storing and appending command-line arguments. 53 // Used for storing and appending command-line arguments.
53 base::CommandLine command_line_; 54 base::CommandLine command_line_;
54 55
55 // The string to be displayed in a JumpList. 56 // The string to be displayed in a JumpList.
56 base::string16 title_; 57 base::string16 title_;
57 58
58 // The absolute path to an icon to be displayed in a JumpList. 59 // The absolute path to an icon to be displayed in a JumpList.
59 base::string16 icon_path_; 60 base::string16 icon_path_;
60 61
62 // The tab URL corresponding to this link's favicon.
63 std::string url_;
64
61 // The icon index in the icon file. If an icon file consists of two or more 65 // The icon index in the icon file. If an icon file consists of two or more
62 // icons, set this value to identify the icon. If an icon file consists of 66 // icons, set this value to identify the icon. If an icon file consists of
63 // one icon, this value is 0. 67 // one icon, this value is 0.
64 int icon_index_; 68 int icon_index_;
65 69
66 // Icon image. Used by the browser JumpList. 70 // Icon image. Used by the browser JumpList.
67 // Note that an icon path must be supplied to IShellLink, so users of this 71 // Note that an icon path must be supplied to IShellLink, so users of this
68 // class must save icon data to disk. 72 // class must save icon data to disk.
69 gfx::ImageSkia icon_image_; 73 gfx::ImageSkia icon_image_;
70 74
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 base::win::ScopedComPtr<ICustomDestinationList> destination_list_; 134 base::win::ScopedComPtr<ICustomDestinationList> destination_list_;
131 135
132 // The current user setting for "Number of recent items to display in Jump 136 // The current user setting for "Number of recent items to display in Jump
133 // Lists" option in the "Taskbar and Start Menu Properties". 137 // Lists" option in the "Taskbar and Start Menu Properties".
134 size_t user_max_items_; 138 size_t user_max_items_;
135 139
136 DISALLOW_COPY_AND_ASSIGN(JumpListUpdater); 140 DISALLOW_COPY_AND_ASSIGN(JumpListUpdater);
137 }; 141 };
138 142
139 #endif // CHROME_BROWSER_WIN_JUMPLIST_UPDATER_H_ 143 #endif // CHROME_BROWSER_WIN_JUMPLIST_UPDATER_H_
OLDNEW
« no previous file with comments | « chrome/browser/win/jumplist_file_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698