OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "chrome/browser/cancelable_request.h" | 15 #include "chrome/browser/cancelable_request.h" |
16 #include "chrome/browser/history/history.h" | 16 #include "chrome/browser/history/history.h" |
17 #include "chrome/browser/sessions/tab_restore_service.h" | 17 #include "chrome/browser/sessions/tab_restore_service.h" |
18 #include "chrome/browser/sessions/tab_restore_service_observer.h" | |
19 | 18 |
20 class FilePath; | 19 class FilePath; |
21 class Profile; | 20 class Profile; |
22 class PageUsageData; | 21 class PageUsageData; |
23 | 22 |
24 // Represents a class used for creating an IShellLink object by the utility | 23 // Represents a class used for creating an IShellLink object by the utility |
25 // functions in this file. | 24 // functions in this file. |
26 // This class consists of three strings and a integer. | 25 // This class consists of three strings and a integer. |
27 // * arguments (std::wstring) | 26 // * arguments (std::wstring) |
28 // The arguments for the application. | 27 // The arguments for the application. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList; | 84 typedef std::vector<scoped_refptr<ShellLinkItem> > ShellLinkItemList; |
86 | 85 |
87 // A class which implements an application JumpList. | 86 // A class which implements an application JumpList. |
88 // This class encapsulates operations required for updating an application | 87 // This class encapsulates operations required for updating an application |
89 // JumpList: | 88 // JumpList: |
90 // * Retrieving "Most Visited" pages from HistoryService; | 89 // * Retrieving "Most Visited" pages from HistoryService; |
91 // * Retrieving strings from the application resource; | 90 // * Retrieving strings from the application resource; |
92 // * Creatng COM objects used by JumpList from PageUsageData objects; | 91 // * Creatng COM objects used by JumpList from PageUsageData objects; |
93 // * Adding COM objects to JumpList, etc. | 92 // * Adding COM objects to JumpList, etc. |
94 // | 93 // |
95 // This class also implements TabRestoreServiceObserver. So, once we call | 94 // This class also implements TabRestoreService::Observer. So, once we call |
96 // AddObserver() and register this class as an observer, it automatically | 95 // AddObserver() and register this class as an observer, it automatically |
97 // updates a JumpList when a tab is added or removed. | 96 // updates a JumpList when a tab is added or removed. |
98 // | 97 // |
99 // Updating a JumpList requires some file operations and it is not good to | 98 // Updating a JumpList requires some file operations and it is not good to |
100 // update it in a UI thread. To solve this problem, this class posts a | 99 // update it in a UI thread. To solve this problem, this class posts a |
101 // task when it actually updates a JumpList. (This task is implemented in an | 100 // task when it actually updates a JumpList. (This task is implemented in an |
102 // anomynous namespace in "jumplist_win.cc".) | 101 // anomynous namespace in "jumplist_win.cc".) |
103 class JumpList : public TabRestoreServiceObserver { | 102 class JumpList : public TabRestoreService::Observer { |
104 public: | 103 public: |
105 JumpList(); | 104 JumpList(); |
106 ~JumpList(); | 105 ~JumpList(); |
107 | 106 |
108 // Registers (or unregisters) this object as an observer. | 107 // Registers (or unregisters) this object as an observer. |
109 // When the TabRestoreService object notifies the tab status is changed, this | 108 // When the TabRestoreService object notifies the tab status is changed, this |
110 // class automatically updates an application JumpList. | 109 // class automatically updates an application JumpList. |
111 bool AddObserver(Profile* profile); | 110 bool AddObserver(Profile* profile); |
112 void RemoveObserver(); | 111 void RemoveObserver(); |
113 | 112 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 183 |
185 // Items in the "Recently Closed" category of the application JumpList. | 184 // Items in the "Recently Closed" category of the application JumpList. |
186 ShellLinkItemList recently_closed_pages_; | 185 ShellLinkItemList recently_closed_pages_; |
187 | 186 |
188 // A list of URLs we need to retrieve their fav icons. | 187 // A list of URLs we need to retrieve their fav icons. |
189 typedef std::pair<std::string, scoped_refptr<ShellLinkItem> > URLPair; | 188 typedef std::pair<std::string, scoped_refptr<ShellLinkItem> > URLPair; |
190 std::list<URLPair> icon_urls_; | 189 std::list<URLPair> icon_urls_; |
191 }; | 190 }; |
192 | 191 |
193 #endif // CHROME_BROWSER_JUMPLIST_WIN_H_ | 192 #endif // CHROME_BROWSER_JUMPLIST_WIN_H_ |
OLD | NEW |