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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_model.cc

Issue 11137024: Factoring out of FaviconLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/intents/web_intent_picker_model.h" 5 #include "chrome/browser/ui/intents/web_intent_picker_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (service->url == url) 84 if (service->url == url)
85 return service; 85 return service;
86 } 86 }
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 size_t WebIntentPickerModel::GetInstalledServiceCount() const { 90 size_t WebIntentPickerModel::GetInstalledServiceCount() const {
91 return installed_services_.size(); 91 return installed_services_.size();
92 } 92 }
93 93
94 void WebIntentPickerModel::UpdateFaviconAt(size_t index, 94 void WebIntentPickerModel::UpdateFaviconForServiceWithURL(
95 const gfx::Image& image) { 95 const GURL& url, const gfx::Image& image) {
96 DCHECK_LT(index, installed_services_.size()); 96 for (size_t i = 0; i < installed_services_.size(); ++i) {
97 installed_services_[index]->favicon = image; 97 InstalledService* service = installed_services_[i];
98 if (observer_) 98 if (service->url == url) {
99 observer_->OnFaviconChanged(this, index); 99 service->favicon = image;
100 if (observer_)
101 observer_->OnFaviconChanged(this, i);
102 return;
103 }
104 }
105 NOTREACHED(); // Calling this with an invalid URL is not allowed.
100 } 106 }
101 107
102 void WebIntentPickerModel::AddSuggestedExtensions( 108 void WebIntentPickerModel::AddSuggestedExtensions(
103 const std::vector<SuggestedExtension>& suggestions) { 109 const std::vector<SuggestedExtension>& suggestions) {
104 suggested_extensions_.insert(suggested_extensions_.end(), 110 suggested_extensions_.insert(suggested_extensions_.end(),
105 suggestions.begin(), 111 suggestions.begin(),
106 suggestions.end()); 112 suggestions.end());
107 if (observer_) 113 if (observer_)
108 observer_->OnModelChanged(this); 114 observer_->OnModelChanged(this);
109 } 115 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 double average_rating) 265 double average_rating)
260 : title(title), 266 : title(title),
261 id(id), 267 id(id),
262 average_rating(average_rating), 268 average_rating(average_rating),
263 icon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( 269 icon(ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
264 IDR_DEFAULT_FAVICON)) { 270 IDR_DEFAULT_FAVICON)) {
265 } 271 }
266 272
267 WebIntentPickerModel::SuggestedExtension::~SuggestedExtension() { 273 WebIntentPickerModel::SuggestedExtension::~SuggestedExtension() {
268 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698