OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // ModelEntry ---------------------------------------------------- | 27 // ModelEntry ---------------------------------------------------- |
28 | 28 |
29 // ModelEntry wraps a TemplateURL as returned from the TemplateURL. | 29 // ModelEntry wraps a TemplateURL as returned from the TemplateURL. |
30 // ModelEntry also tracks state information about the URL. | 30 // ModelEntry also tracks state information about the URL. |
31 | 31 |
32 // Icon used while loading, or if a specific favicon can't be found. | 32 // Icon used while loading, or if a specific favicon can't be found. |
33 static SkBitmap* default_icon = NULL; | 33 static SkBitmap* default_icon = NULL; |
34 | 34 |
35 class ModelEntry { | 35 class ModelEntry { |
36 public: | 36 public: |
37 explicit ModelEntry(TemplateURLTableModel* model, | 37 ModelEntry(TemplateURLTableModel* model, const TemplateURL& template_url) |
38 const TemplateURL& template_url) | |
39 : template_url_(template_url), | 38 : template_url_(template_url), |
40 load_state_(NOT_LOADED), | 39 load_state_(NOT_LOADED), |
41 model_(model) { | 40 model_(model) { |
42 if (!default_icon) { | 41 if (!default_icon) { |
43 default_icon = ResourceBundle::GetSharedInstance(). | 42 default_icon = ResourceBundle::GetSharedInstance(). |
44 GetBitmapNamed(IDR_DEFAULT_FAVICON); | 43 GetBitmapNamed(IDR_DEFAULT_FAVICON); |
45 } | 44 } |
46 } | 45 } |
47 | 46 |
48 const TemplateURL& template_url() { | 47 const TemplateURL& template_url() { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) { | 364 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) { |
366 std::vector<ModelEntry*>::iterator i = | 365 std::vector<ModelEntry*>::iterator i = |
367 find(entries_.begin(), entries_.end(), entry); | 366 find(entries_.begin(), entries_.end(), entry); |
368 DCHECK(i != entries_.end()); | 367 DCHECK(i != entries_.end()); |
369 NotifyChanged(static_cast<int>(i - entries_.begin())); | 368 NotifyChanged(static_cast<int>(i - entries_.begin())); |
370 } | 369 } |
371 | 370 |
372 void TemplateURLTableModel::OnTemplateURLServiceChanged() { | 371 void TemplateURLTableModel::OnTemplateURLServiceChanged() { |
373 Reload(); | 372 Reload(); |
374 } | 373 } |
OLD | NEW |