| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/search_engines/template_url_table_model.h" | 5 #include "chrome/browser/search_engines/template_url_table_model.h" |
| 6 | 6 |
| 7 #include "app/gfx/codec/png_codec.h" |
| 7 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 9 #include "app/table_model_observer.h" | 10 #include "app/table_model_observer.h" |
| 10 #include "base/gfx/png_decoder.h" | |
| 11 #include "chrome/browser/favicon_service.h" | 11 #include "chrome/browser/favicon_service.h" |
| 12 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
| 13 #include "chrome/browser/search_engines/template_url.h" | 13 #include "chrome/browser/search_engines/template_url.h" |
| 14 #include "chrome/browser/search_engines/template_url_model.h" | 14 #include "chrome/browser/search_engines/template_url_model.h" |
| 15 #include "grit/app_resources.h" | 15 #include "grit/app_resources.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 | 18 |
| 19 // Group IDs used by TemplateURLTableModel. | 19 // Group IDs used by TemplateURLTableModel. |
| 20 static const int kMainGroupID = 0; | 20 static const int kMainGroupID = 0; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 void OnFavIconDataAvailable( | 95 void OnFavIconDataAvailable( |
| 96 FaviconService::Handle handle, | 96 FaviconService::Handle handle, |
| 97 bool know_favicon, | 97 bool know_favicon, |
| 98 scoped_refptr<RefCountedBytes> data, | 98 scoped_refptr<RefCountedBytes> data, |
| 99 bool expired, | 99 bool expired, |
| 100 GURL icon_url) { | 100 GURL icon_url) { |
| 101 load_state_ = LOADED; | 101 load_state_ = LOADED; |
| 102 if (know_favicon && data.get() && | 102 if (know_favicon && data.get() && |
| 103 PNGDecoder::Decode(&data->data, &fav_icon_)) { | 103 gfx::PNGCodec::Decode(&data->data, &fav_icon_)) { |
| 104 model_->FavIconAvailable(this); | 104 model_->FavIconAvailable(this); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 const TemplateURL& template_url_; | 108 const TemplateURL& template_url_; |
| 109 SkBitmap fav_icon_; | 109 SkBitmap fav_icon_; |
| 110 LoadState load_state_; | 110 LoadState load_state_; |
| 111 TemplateURLTableModel* model_; | 111 TemplateURLTableModel* model_; |
| 112 CancelableRequestConsumer request_consumer_; | 112 CancelableRequestConsumer request_consumer_; |
| 113 | 113 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) { | 362 void TemplateURLTableModel::FavIconAvailable(ModelEntry* entry) { |
| 363 std::vector<ModelEntry*>::iterator i = | 363 std::vector<ModelEntry*>::iterator i = |
| 364 find(entries_.begin(), entries_.end(), entry); | 364 find(entries_.begin(), entries_.end(), entry); |
| 365 DCHECK(i != entries_.end()); | 365 DCHECK(i != entries_.end()); |
| 366 NotifyChanged(static_cast<int>(i - entries_.begin())); | 366 NotifyChanged(static_cast<int>(i - entries_.begin())); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void TemplateURLTableModel::OnTemplateURLModelChanged() { | 369 void TemplateURLTableModel::OnTemplateURLModelChanged() { |
| 370 Reload(); | 370 Reload(); |
| 371 } | 371 } |
| OLD | NEW |