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