OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ |
6 #define CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ | 6 #define CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "app/table_model.h" | 12 #include "app/table_model.h" |
| 13 #include "base/scoped_ptr.h" |
13 #include "chrome/browser/history/history.h" | 14 #include "chrome/browser/history/history.h" |
14 #include "chrome/browser/favicon_service.h" | 15 #include "chrome/browser/favicon_service.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
17 | 18 |
18 class Profile; | 19 class Profile; |
19 class TableModelObserver; | 20 class TableModelObserver; |
20 | 21 |
21 // CustomHomePagesTableModel is the model for the TableView showing the list | 22 // CustomHomePagesTableModel is the model for the TableView showing the list |
22 // of pages the user wants opened on startup. | 23 // of pages the user wants opened on startup. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Icon for the page. | 65 // Icon for the page. |
65 SkBitmap icon; | 66 SkBitmap icon; |
66 | 67 |
67 // If non-zero, indicates we're loading the title for the page. | 68 // If non-zero, indicates we're loading the title for the page. |
68 HistoryService::Handle title_handle; | 69 HistoryService::Handle title_handle; |
69 | 70 |
70 // If non-zero, indicates we're loading the favicon for the page. | 71 // If non-zero, indicates we're loading the favicon for the page. |
71 FaviconService::Handle fav_icon_handle; | 72 FaviconService::Handle fav_icon_handle; |
72 }; | 73 }; |
73 | 74 |
74 static void InitClass(); | |
75 | |
76 // Loads the title and favicon for the specified entry. | 75 // Loads the title and favicon for the specified entry. |
77 void LoadTitleAndFavIcon(Entry* entry); | 76 void LoadTitleAndFavIcon(Entry* entry); |
78 | 77 |
79 // Callback from history service. Updates the title of the Entry whose | 78 // Callback from history service. Updates the title of the Entry whose |
80 // |title_handle| matches |handle| and notifies the observer of the change. | 79 // |title_handle| matches |handle| and notifies the observer of the change. |
81 void OnGotTitle(HistoryService::Handle handle, | 80 void OnGotTitle(HistoryService::Handle handle, |
82 bool found_url, | 81 bool found_url, |
83 const history::URLRow* row, | 82 const history::URLRow* row, |
84 history::VisitVector* visits); | 83 history::VisitVector* visits); |
85 | 84 |
(...skipping 16 matching lines...) Expand all Loading... |
102 Entry* GetEntryByFavIconHandle(FaviconService::Handle handle, | 101 Entry* GetEntryByFavIconHandle(FaviconService::Handle handle, |
103 int* entry_index); | 102 int* entry_index); |
104 | 103 |
105 // Returns the URL for a particular row, formatted for display to the user. | 104 // Returns the URL for a particular row, formatted for display to the user. |
106 std::wstring FormattedURL(int row) const; | 105 std::wstring FormattedURL(int row) const; |
107 | 106 |
108 // Set of entries we're showing. | 107 // Set of entries we're showing. |
109 std::vector<Entry> entries_; | 108 std::vector<Entry> entries_; |
110 | 109 |
111 // Default icon to show when one can't be found for the URL. | 110 // Default icon to show when one can't be found for the URL. |
112 static SkBitmap default_favicon_; | 111 SkBitmap* default_favicon_; |
113 | 112 |
114 // Profile used to load titles and icons. | 113 // Profile used to load titles and icons. |
115 Profile* profile_; | 114 Profile* profile_; |
116 | 115 |
117 TableModelObserver* observer_; | 116 TableModelObserver* observer_; |
118 | 117 |
119 // Used in loading titles and favicons. | 118 // Used in loading titles and favicons. |
120 CancelableRequestConsumer query_consumer_; | 119 CancelableRequestConsumer query_consumer_; |
121 | 120 |
122 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel); | 121 DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel); |
123 }; | 122 }; |
124 | 123 |
125 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ | 124 #endif // CHROME_BROWSER_CUSTOM_HOME_PAGES_TABLE_MODEL_H_ |
OLD | NEW |