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

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

Issue 333493002: Load the default favicon as a native image, rather than as a Skia image. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 18 matching lines...) Expand all
29 static const int kMainGroupID = 0; 29 static const int kMainGroupID = 0;
30 static const int kOtherGroupID = 1; 30 static const int kOtherGroupID = 1;
31 static const int kExtensionGroupID = 2; 31 static const int kExtensionGroupID = 2;
32 32
33 // ModelEntry ---------------------------------------------------- 33 // ModelEntry ----------------------------------------------------
34 34
35 // ModelEntry wraps a TemplateURL as returned from the TemplateURL. 35 // ModelEntry wraps a TemplateURL as returned from the TemplateURL.
36 // ModelEntry also tracks state information about the URL. 36 // ModelEntry also tracks state information about the URL.
37 37
38 // Icon used while loading, or if a specific favicon can't be found. 38 // Icon used while loading, or if a specific favicon can't be found.
39 static gfx::ImageSkia* default_icon = NULL; 39 static const gfx::ImageSkia* default_icon = NULL;
40 40
41 class ModelEntry { 41 class ModelEntry {
42 public: 42 public:
43 ModelEntry(TemplateURLTableModel* model, TemplateURL* template_url) 43 ModelEntry(TemplateURLTableModel* model, TemplateURL* template_url)
44 : template_url_(template_url), 44 : template_url_(template_url),
45 load_state_(NOT_LOADED), 45 load_state_(NOT_LOADED),
46 model_(model) { 46 model_(model) {
47 if (!default_icon) { 47 if (!default_icon) {
48 default_icon = ResourceBundle::GetSharedInstance(). 48 default_icon = ResourceBundle::GetSharedInstance().
49 GetImageSkiaNamed(IDR_DEFAULT_FAVICON); 49 GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToImageSkia();
50 } 50 }
51 } 51 }
52 52
53 TemplateURL* template_url() { 53 TemplateURL* template_url() {
54 return template_url_; 54 return template_url_;
55 } 55 }
56 56
57 gfx::ImageSkia GetIcon() { 57 gfx::ImageSkia GetIcon() {
58 if (load_state_ == NOT_LOADED) 58 if (load_state_ == NOT_LOADED)
59 LoadFavicon(); 59 LoadFavicon();
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return entry.Pass(); 391 return entry.Pass();
392 } 392 }
393 393
394 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) { 394 void TemplateURLTableModel::AddEntry(int index, scoped_ptr<ModelEntry> entry) {
395 entries_.insert(entries_.begin() + index, entry.release()); 395 entries_.insert(entries_.begin() + index, entry.release());
396 if (index <= last_other_engine_index_) 396 if (index <= last_other_engine_index_)
397 ++last_other_engine_index_; 397 ++last_other_engine_index_;
398 if (observer_) 398 if (observer_)
399 observer_->OnItemsAdded(index, 1); 399 observer_->OnItemsAdded(index, 1);
400 } 400 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698