OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/history/history.h" | 8 #include "chrome/browser/history/history.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 bool FaviconTabHelper::ShouldDisplayFavicon() { | 77 bool FaviconTabHelper::ShouldDisplayFavicon() { |
78 // Always display a throbber during pending loads. | 78 // Always display a throbber during pending loads. |
79 const NavigationController& controller = web_contents()->GetController(); | 79 const NavigationController& controller = web_contents()->GetController(); |
80 if (controller.GetLastCommittedEntry() && controller.GetPendingEntry()) | 80 if (controller.GetLastCommittedEntry() && controller.GetPendingEntry()) |
81 return true; | 81 return true; |
82 | 82 |
83 WebUI* web_ui = web_contents()->GetWebUIForCurrentState(); | 83 WebUI* web_ui = web_contents()->GetWebUIForCurrentState(); |
84 if (web_ui) | 84 if (web_ui) |
85 return !web_ui->hide_favicon(); | 85 return !web_ui->ShouldHideFavicon(); |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void FaviconTabHelper::SaveFavicon() { | 89 void FaviconTabHelper::SaveFavicon() { |
90 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); | 90 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); |
91 if (!entry || entry->GetURL().is_empty()) | 91 if (!entry || entry->GetURL().is_empty()) |
92 return; | 92 return; |
93 | 93 |
94 // Make sure the page is in history, otherwise adding the favicon does | 94 // Make sure the page is in history, otherwise adding the favicon does |
95 // nothing. | 95 // nothing. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 void FaviconTabHelper::OnDidDownloadFavicon(int id, | 185 void FaviconTabHelper::OnDidDownloadFavicon(int id, |
186 const GURL& image_url, | 186 const GURL& image_url, |
187 bool errored, | 187 bool errored, |
188 const SkBitmap& image) { | 188 const SkBitmap& image) { |
189 gfx::Image favicon(new SkBitmap(image)); | 189 gfx::Image favicon(new SkBitmap(image)); |
190 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 190 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
191 if (touch_icon_handler_.get()) | 191 if (touch_icon_handler_.get()) |
192 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 192 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
193 } | 193 } |
OLD | NEW |