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

Side by Side Diff: chrome/browser/custom_home_pages_table_model.cc

Issue 6651014: Applied the IconType. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 9 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) 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 #include "chrome/browser/custom_home_pages_table_model.h" 5 #include "chrome/browser/custom_home_pages_table_model.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 HistoryService* history_service = 156 HistoryService* history_service =
157 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 157 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
158 if (history_service) { 158 if (history_service) {
159 entry->title_handle = history_service->QueryURL(entry->url, false, 159 entry->title_handle = history_service->QueryURL(entry->url, false,
160 &query_consumer_, 160 &query_consumer_,
161 NewCallback(this, &CustomHomePagesTableModel::OnGotTitle)); 161 NewCallback(this, &CustomHomePagesTableModel::OnGotTitle));
162 } 162 }
163 FaviconService* favicon_service = 163 FaviconService* favicon_service =
164 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 164 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
165 if (favicon_service) { 165 if (favicon_service) {
166 entry->fav_icon_handle = favicon_service->GetFaviconForURL(entry->url, 166 entry->fav_icon_handle = favicon_service->GetFaviconForURL(
167 entry->url,
168 history::FAV_ICON,
167 &query_consumer_, 169 &query_consumer_,
168 NewCallback(this, &CustomHomePagesTableModel::OnGotFavIcon)); 170 NewCallback(this, &CustomHomePagesTableModel::OnGotFavIcon));
169 } 171 }
170 } 172 }
171 173
172 void CustomHomePagesTableModel::OnGotTitle(HistoryService::Handle handle, 174 void CustomHomePagesTableModel::OnGotTitle(HistoryService::Handle handle,
173 bool found_url, 175 bool found_url,
174 const history::URLRow* row, 176 const history::URLRow* row,
175 history::VisitVector* visits) { 177 history::VisitVector* visits) {
176 int entry_index; 178 int entry_index;
177 Entry* entry = 179 Entry* entry =
178 GetEntryByLoadHandle(&Entry::title_handle, handle, &entry_index); 180 GetEntryByLoadHandle(&Entry::title_handle, handle, &entry_index);
179 if (!entry) { 181 if (!entry) {
180 // The URLs changed before we were called back. 182 // The URLs changed before we were called back.
181 return; 183 return;
182 } 184 }
183 entry->title_handle = 0; 185 entry->title_handle = 0;
184 if (found_url && !row->title().empty()) { 186 if (found_url && !row->title().empty()) {
185 entry->title = row->title(); 187 entry->title = row->title();
186 if (observer_) 188 if (observer_)
187 observer_->OnItemsChanged(static_cast<int>(entry_index), 1); 189 observer_->OnItemsChanged(static_cast<int>(entry_index), 1);
188 } 190 }
189 } 191 }
190 192
191 void CustomHomePagesTableModel::OnGotFavIcon( 193 void CustomHomePagesTableModel::OnGotFavIcon(
192 FaviconService::Handle handle, 194 FaviconService::Handle handle,
193 bool know_fav_icon, 195 bool know_fav_icon,
194 scoped_refptr<RefCountedMemory> image_data, 196 scoped_refptr<RefCountedMemory> image_data,
195 bool is_expired, 197 bool is_expired,
196 GURL icon_url) { 198 GURL icon_url,
199 history::IconType) {
sky 2011/03/09 21:41:08 include name
michaelbai 2011/03/09 23:11:45 Done.
michaelbai 2011/03/09 23:11:45 Done.
197 int entry_index; 200 int entry_index;
198 Entry* entry = 201 Entry* entry =
199 GetEntryByLoadHandle(&Entry::fav_icon_handle, handle, &entry_index); 202 GetEntryByLoadHandle(&Entry::fav_icon_handle, handle, &entry_index);
200 if (!entry) { 203 if (!entry) {
201 // The URLs changed before we were called back. 204 // The URLs changed before we were called back.
202 return; 205 return;
203 } 206 }
204 entry->fav_icon_handle = 0; 207 entry->fav_icon_handle = 0;
205 if (know_fav_icon && image_data.get() && image_data->size()) { 208 if (know_fav_icon && image_data.get() && image_data->size()) {
206 int width, height; 209 int width, height;
(...skipping 26 matching lines...) Expand all
233 return NULL; 236 return NULL;
234 } 237 }
235 238
236 string16 CustomHomePagesTableModel::FormattedURL(int row) const { 239 string16 CustomHomePagesTableModel::FormattedURL(int row) const {
237 std::string languages = 240 std::string languages =
238 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); 241 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
239 string16 url = net::FormatUrl(entries_[row].url, languages); 242 string16 url = net::FormatUrl(entries_[row].url, languages);
240 url = base::i18n::GetDisplayStringInLTRDirectionality(url); 243 url = base::i18n::GetDisplayStringInLTRDirectionality(url);
241 return url; 244 return url;
242 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698