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

Side by Side Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 261403003: Removes usage of NavigationEntry from favicon_handler.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
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/favicon/favicon_tab_helper.h" 5 #include "chrome/browser/favicon/favicon_tab_helper.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/favicon/favicon_handler.h" 9 #include "chrome/browser/favicon/favicon_handler.h"
10 #include "chrome/browser/favicon/favicon_service_factory.h" 10 #include "chrome/browser/favicon/favicon_service_factory.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 content::Source<WebContents>(web_contents()), 160 content::Source<WebContents>(web_contents()),
161 content::Details<bool>(&icon_url_changed)); 161 content::Details<bool>(&icon_url_changed));
162 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); 162 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB);
163 } 163 }
164 164
165 bool FaviconTabHelper::IsOffTheRecord() { 165 bool FaviconTabHelper::IsOffTheRecord() {
166 DCHECK(web_contents()); 166 DCHECK(web_contents());
167 return web_contents()->GetBrowserContext()->IsOffTheRecord(); 167 return web_contents()->GetBrowserContext()->IsOffTheRecord();
168 } 168 }
169 169
170 const GURL FaviconTabHelper::GetActiveURL() {
171 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry();
172 if (!entry || entry->GetURL().is_empty())
173 return GURL();
174 return entry->GetURL();
175 }
176
177 const GURL FaviconTabHelper::GetActiveFaviconURL() {
178 return GURL();
blundell 2014/05/06 15:04:00 could you implement these so we can see the full C
jif 2014/05/09 14:17:18 Done.
179 }
180
181 bool FaviconTabHelper::GetActiveFaviconValidity() {
182 return false;
183 }
184
185 void FaviconTabHelper::SetActiveFaviconValidity(bool validity) {
186 web_contents()->GetController().GetActiveEntry()->GetFavicon().valid =
blundell 2014/05/06 15:04:00 the active entry can be NULL. You probably want a
jif 2014/05/09 14:17:18 Done.
187 validity;
188 }
189
190 void FaviconTabHelper::SetActiveFaviconImage(gfx::Image image) {
191 web_contents()->GetController().GetActiveEntry()->GetFavicon().image = image;
192 }
193
194 void FaviconTabHelper::SetActiveFaviconURL(GURL url) {
195 web_contents()->GetController().GetActiveEntry()->GetFavicon().url = url;
196 }
197
170 void FaviconTabHelper::DidStartNavigationToPendingEntry( 198 void FaviconTabHelper::DidStartNavigationToPendingEntry(
171 const GURL& url, 199 const GURL& url,
172 NavigationController::ReloadType reload_type) { 200 NavigationController::ReloadType reload_type) {
173 if (reload_type != NavigationController::NO_RELOAD && 201 if (reload_type != NavigationController::NO_RELOAD &&
174 !profile_->IsOffTheRecord()) { 202 !profile_->IsOffTheRecord()) {
175 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 203 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
176 profile_, Profile::IMPLICIT_ACCESS); 204 profile_, Profile::IMPLICIT_ACCESS);
177 if (favicon_service) { 205 if (favicon_service) {
178 favicon_service->SetFaviconOutOfDateForPage(url); 206 favicon_service->SetFaviconOutOfDateForPage(url);
179 if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) 207 if (reload_type == NavigationController::RELOAD_IGNORING_CACHE)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 favicon_service->UnableToDownloadFavicon(image_url); 253 favicon_service->UnableToDownloadFavicon(image_url);
226 } 254 }
227 255
228 favicon_handler_->OnDidDownloadFavicon( 256 favicon_handler_->OnDidDownloadFavicon(
229 id, image_url, bitmaps, original_bitmap_sizes); 257 id, image_url, bitmaps, original_bitmap_sizes);
230 if (touch_icon_handler_.get()) { 258 if (touch_icon_handler_.get()) {
231 touch_icon_handler_->OnDidDownloadFavicon( 259 touch_icon_handler_->OnDidDownloadFavicon(
232 id, image_url, bitmaps, original_bitmap_sizes); 260 id, image_url, bitmaps, original_bitmap_sizes);
233 } 261 }
234 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698