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

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

Issue 10821035: wip Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 favicon_service->GetFavicon(favicon_url, history::FAVICON, 95 favicon_service->GetFavicon(favicon_url, history::FAVICON,
96 &request_consumer_, 96 &request_consumer_,
97 base::Bind(&ModelEntry::OnFaviconDataAvailable, 97 base::Bind(&ModelEntry::OnFaviconDataAvailable,
98 base::Unretained(this))); 98 base::Unretained(this)));
99 } 99 }
100 100
101 void OnFaviconDataAvailable( 101 void OnFaviconDataAvailable(
102 FaviconService::Handle handle, 102 FaviconService::Handle handle,
103 history::FaviconData favicon) { 103 history::FaviconData favicon) {
104 load_state_ = LOADED; 104 load_state_ = LOADED;
105 if (favicon.is_valid() && gfx::PNGCodec::Decode(favicon.bitmap_data->front() , 105 if (favicon.is_valid() && favicon.variants.size() > 0 &&
106 favicon.bitmap_data->size(), 106 gfx::PNGCodec::Decode(favicon.variants[0].bitmap_data->front(),
107 &favicon_)) { 107 favicon.variants[0].bitmap_data->size(),
108 &favicon_)) {
108 model_->FaviconAvailable(this); 109 model_->FaviconAvailable(this);
109 } 110 }
110 } 111 }
111 112
112 TemplateURL* template_url_; 113 TemplateURL* template_url_;
113 SkBitmap favicon_; 114 SkBitmap favicon_;
114 LoadState load_state_; 115 LoadState load_state_;
115 TemplateURLTableModel* model_; 116 TemplateURLTableModel* model_;
116 CancelableRequestConsumer request_consumer_; 117 CancelableRequestConsumer request_consumer_;
117 118
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) { 367 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) {
367 std::vector<ModelEntry*>::iterator i = 368 std::vector<ModelEntry*>::iterator i =
368 std::find(entries_.begin(), entries_.end(), entry); 369 std::find(entries_.begin(), entries_.end(), entry);
369 DCHECK(i != entries_.end()); 370 DCHECK(i != entries_.end());
370 NotifyChanged(static_cast<int>(i - entries_.begin())); 371 NotifyChanged(static_cast<int>(i - entries_.begin()));
371 } 372 }
372 373
373 void TemplateURLTableModel::OnTemplateURLServiceChanged() { 374 void TemplateURLTableModel::OnTemplateURLServiceChanged() {
374 Reload(); 375 Reload();
375 } 376 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | chrome/browser/ui/toolbar/back_forward_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698