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

Side by Side Diff: chrome/browser/ui/search_engines/template_url_table_model.cc

Issue 10918065: Introduce structures to reduce the number of arguments in the FaviconService methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac build fix. Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/search_engines/template_url_table_model.h" 5 #include "chrome/browser/ui/search_engines/template_url_table_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // The favicon url isn't always set. Guess at one here. 85 // The favicon url isn't always set. Guess at one here.
86 if (template_url_->url_ref().IsValid()) { 86 if (template_url_->url_ref().IsValid()) {
87 GURL url(template_url_->url()); 87 GURL url(template_url_->url());
88 if (url.is_valid()) 88 if (url.is_valid())
89 favicon_url = TemplateURL::GenerateFaviconURL(url); 89 favicon_url = TemplateURL::GenerateFaviconURL(url);
90 } 90 }
91 if (!favicon_url.is_valid()) 91 if (!favicon_url.is_valid())
92 return; 92 return;
93 } 93 }
94 load_state_ = LOADING; 94 load_state_ = LOADING;
95 favicon_service->GetFaviconImage(favicon_url, history::FAVICON, 95 favicon_service->GetFaviconImage(
96 gfx::kFaviconSize, &request_consumer_, 96 FaviconService::FaviconParams(favicon_url, history::FAVICON,
97 gfx::kFaviconSize, &request_consumer_),
97 base::Bind(&ModelEntry::OnFaviconDataAvailable, 98 base::Bind(&ModelEntry::OnFaviconDataAvailable,
98 base::Unretained(this))); 99 base::Unretained(this)));
99 } 100 }
100 101
101 void OnFaviconDataAvailable( 102 void OnFaviconDataAvailable(
102 FaviconService::Handle handle, 103 FaviconService::Handle handle,
103 const history::FaviconImageResult& image_result) { 104 const history::FaviconImageResult& image_result) {
104 load_state_ = LOADED; 105 load_state_ = LOADED;
105 if (!image_result.image.IsEmpty()) { 106 if (!image_result.image.IsEmpty()) {
106 favicon_ = image_result.image.AsImageSkia(); 107 favicon_ = image_result.image.AsImageSkia();
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) { 366 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) {
366 std::vector<ModelEntry*>::iterator i = 367 std::vector<ModelEntry*>::iterator i =
367 std::find(entries_.begin(), entries_.end(), entry); 368 std::find(entries_.begin(), entries_.end(), entry);
368 DCHECK(i != entries_.end()); 369 DCHECK(i != entries_.end());
369 NotifyChanged(static_cast<int>(i - entries_.begin())); 370 NotifyChanged(static_cast<int>(i - entries_.begin()));
370 } 371 }
371 372
372 void TemplateURLTableModel::OnTemplateURLServiceChanged() { 373 void TemplateURLTableModel::OnTemplateURLServiceChanged() {
373 Reload(); 374 Reload();
374 } 375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698