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

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

Issue 10873022: Revert 152904 - Moving FaviconService to a ProfileKeyedService. (Closed) 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"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/favicon/favicon_service.h" 12 #include "chrome/browser/favicon/favicon_service.h"
13 #include "chrome/browser/favicon/favicon_service_factory.h"
14 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/search_engines/template_url.h" 14 #include "chrome/browser/search_engines/template_url.h"
16 #include "chrome/browser/search_engines/template_url_service.h" 15 #include "chrome/browser/search_engines/template_url_service.h"
17 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
18 #include "grit/ui_resources.h" 17 #include "grit/ui_resources.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 18 #include "third_party/skia/include/core/SkBitmap.h"
20 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/base/models/table_model_observer.h" 20 #include "ui/base/models/table_model_observer.h"
22 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/codec/png_codec.h" 22 #include "ui/gfx/codec/png_codec.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 private: 68 private:
70 // State of the favicon. 69 // State of the favicon.
71 enum LoadState { 70 enum LoadState {
72 NOT_LOADED, 71 NOT_LOADED,
73 LOADING, 72 LOADING,
74 LOADED 73 LOADED
75 }; 74 };
76 75
77 void LoadFavicon() { 76 void LoadFavicon() {
78 load_state_ = LOADED; 77 load_state_ = LOADED;
79 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 78 FaviconService* favicon_service =
80 model_->template_url_service()->profile(), Profile::EXPLICIT_ACCESS); 79 model_->template_url_service()->profile()->GetFaviconService(
80 Profile::EXPLICIT_ACCESS);
81 if (!favicon_service) 81 if (!favicon_service)
82 return; 82 return;
83 GURL favicon_url = template_url()->favicon_url(); 83 GURL favicon_url = template_url()->favicon_url();
84 if (!favicon_url.is_valid()) { 84 if (!favicon_url.is_valid()) {
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 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) { 366 void TemplateURLTableModel::FaviconAvailable(ModelEntry* entry) {
367 std::vector<ModelEntry*>::iterator i = 367 std::vector<ModelEntry*>::iterator i =
368 std::find(entries_.begin(), entries_.end(), entry); 368 std::find(entries_.begin(), entries_.end(), entry);
369 DCHECK(i != entries_.end()); 369 DCHECK(i != entries_.end());
370 NotifyChanged(static_cast<int>(i - entries_.begin())); 370 NotifyChanged(static_cast<int>(i - entries_.begin()));
371 } 371 }
372 372
373 void TemplateURLTableModel::OnTemplateURLServiceChanged() { 373 void TemplateURLTableModel::OnTemplateURLServiceChanged() {
374 Reload(); 374 Reload();
375 } 375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698