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

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

Issue 14080004: Remove some chrome-specific methods from content::WebUI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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/favicon/favicon_tab_helper.h" 5 #include "chrome/browser/favicon/favicon_tab_helper.h"
6 6
7 #include "chrome/browser/favicon/favicon_handler.h" 7 #include "chrome/browser/favicon/favicon_handler.h"
8 #include "chrome/browser/favicon/favicon_service_factory.h" 8 #include "chrome/browser/favicon/favicon_service_factory.h"
9 #include "chrome/browser/favicon/favicon_util.h" 9 #include "chrome/browser/favicon/favicon_util.h"
10 #include "chrome/browser/history/history_service.h" 10 #include "chrome/browser/history/history_service.h"
11 #include "chrome/browser/history/history_service_factory.h" 11 #include "chrome/browser/history/history_service_factory.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search/search.h" 13 #include "chrome/browser/search/search.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "content/public/browser/favicon_status.h" 16 #include "content/public/browser/favicon_status.h"
17 #include "content/public/browser/invalidate_type.h" 17 #include "content/public/browser/invalidate_type.h"
18 #include "content/public/browser/navigation_controller.h" 18 #include "content/public/browser/navigation_controller.h"
19 #include "content/public/browser/navigation_details.h" 19 #include "content/public/browser/navigation_details.h"
20 #include "content/public/browser/navigation_entry.h" 20 #include "content/public/browser/navigation_entry.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_contents_delegate.h" 24 #include "content/public/browser/web_contents_delegate.h"
25 #include "content/public/browser/web_ui.h" 25 #include "content/public/browser/web_ui.h"
Avi (use Gerrit) 2013/04/10 23:12:15 Is this include still needed, then?
jam 2013/04/10 23:45:35 Done.
26 #include "ui/gfx/codec/png_codec.h" 26 #include "ui/gfx/codec/png_codec.h"
27 #include "ui/gfx/image/image.h" 27 #include "ui/gfx/image/image.h"
28 #include "ui/gfx/image/image_skia.h" 28 #include "ui/gfx/image/image_skia.h"
29 #include "ui/gfx/image/image_skia_rep.h" 29 #include "ui/gfx/image/image_skia_rep.h"
30 30
31 using content::FaviconStatus; 31 using content::FaviconStatus;
32 using content::NavigationController; 32 using content::NavigationController;
33 using content::NavigationEntry; 33 using content::NavigationEntry;
34 using content::WebContents; 34 using content::WebContents;
35 35
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool FaviconTabHelper::ShouldDisplayFavicon() { 88 bool FaviconTabHelper::ShouldDisplayFavicon() {
89 // Always display a throbber during pending loads. 89 // Always display a throbber during pending loads.
90 const NavigationController& controller = web_contents()->GetController(); 90 const NavigationController& controller = web_contents()->GetController();
91 if (controller.GetLastCommittedEntry() && controller.GetPendingEntry()) 91 if (controller.GetLastCommittedEntry() && controller.GetPendingEntry())
92 return true; 92 return true;
93 93
94 // No favicon on Instant New Tab Pages. 94 // No favicon on Instant New Tab Pages.
95 if (chrome::IsInstantNTP(web_contents())) 95 if (chrome::IsInstantNTP(web_contents()))
96 return false; 96 return false;
97 97
98 content::WebUI* web_ui = web_contents()->GetWebUIForCurrentState();
99 if (web_ui)
100 return !web_ui->ShouldHideFavicon();
101 return true; 98 return true;
102 } 99 }
103 100
104 void FaviconTabHelper::SaveFavicon() { 101 void FaviconTabHelper::SaveFavicon() {
105 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); 102 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry();
106 if (!entry || entry->GetURL().is_empty()) 103 if (!entry || entry->GetURL().is_empty())
107 return; 104 return;
108 105
109 // Make sure the page is in history, otherwise adding the favicon does 106 // Make sure the page is in history, otherwise adding the favicon does
110 // nothing. 107 // nothing.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const GURL& image_url, 176 const GURL& image_url,
180 int requested_size, 177 int requested_size,
181 const std::vector<SkBitmap>& bitmaps) { 178 const std::vector<SkBitmap>& bitmaps) {
182 favicon_handler_->OnDidDownloadFavicon( 179 favicon_handler_->OnDidDownloadFavicon(
183 id, image_url, requested_size, bitmaps); 180 id, image_url, requested_size, bitmaps);
184 if (touch_icon_handler_.get()) { 181 if (touch_icon_handler_.get()) {
185 touch_icon_handler_->OnDidDownloadFavicon( 182 touch_icon_handler_->OnDidDownloadFavicon(
186 id, image_url, requested_size, bitmaps); 183 id, image_url, requested_size, bitmaps);
187 } 184 }
188 } 185 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698