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" |
| 11 #include "chrome/common/chrome_notification_types.h" |
11 #include "chrome/common/icon_messages.h" | 12 #include "chrome/common/icon_messages.h" |
12 #include "content/browser/renderer_host/render_view_host.h" | 13 #include "content/browser/renderer_host/render_view_host.h" |
13 #include "content/browser/tab_contents/navigation_controller.h" | 14 #include "content/browser/tab_contents/navigation_controller.h" |
14 #include "content/browser/tab_contents/navigation_details.h" | 15 #include "content/browser/tab_contents/navigation_details.h" |
15 #include "content/browser/tab_contents/tab_contents_delegate.h" | 16 #include "content/browser/tab_contents/tab_contents_delegate.h" |
16 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
17 #include "content/browser/webui/web_ui.h" | 18 #include "content/browser/webui/web_ui.h" |
18 #include "content/common/notification_service.h" | 19 #include "content/common/notification_service.h" |
19 #include "ui/gfx/codec/png_codec.h" | 20 #include "ui/gfx/codec/png_codec.h" |
20 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 131 } |
131 | 132 |
132 void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) { | 133 void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) { |
133 RenderViewHost* host = tab_contents()->render_view_host(); | 134 RenderViewHost* host = tab_contents()->render_view_host(); |
134 host->Send(new IconMsg_DownloadFavicon( | 135 host->Send(new IconMsg_DownloadFavicon( |
135 host->routing_id(), id, url, image_size)); | 136 host->routing_id(), id, url, image_size)); |
136 } | 137 } |
137 | 138 |
138 void FaviconTabHelper::NotifyFaviconUpdated() { | 139 void FaviconTabHelper::NotifyFaviconUpdated() { |
139 NotificationService::current()->Notify( | 140 NotificationService::current()->Notify( |
140 NotificationType::FAVICON_UPDATED, | 141 chrome::NOTIFICATION_FAVICON_UPDATED, |
141 Source<TabContents>(tab_contents()), | 142 Source<TabContents>(tab_contents()), |
142 NotificationService::NoDetails()); | 143 NotificationService::NoDetails()); |
143 tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); | 144 tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); |
144 } | 145 } |
145 | 146 |
146 void FaviconTabHelper::NavigateToPendingEntry( | 147 void FaviconTabHelper::NavigateToPendingEntry( |
147 const GURL& url, | 148 const GURL& url, |
148 NavigationController::ReloadType reload_type) { | 149 NavigationController::ReloadType reload_type) { |
149 if (reload_type != NavigationController::NO_RELOAD && | 150 if (reload_type != NavigationController::NO_RELOAD && |
150 !tab_contents()->profile()->IsOffTheRecord()) { | 151 !tab_contents()->profile()->IsOffTheRecord()) { |
(...skipping 23 matching lines...) Expand all Loading... |
174 | 175 |
175 void FaviconTabHelper::OnDidDownloadFavicon(int id, | 176 void FaviconTabHelper::OnDidDownloadFavicon(int id, |
176 const GURL& image_url, | 177 const GURL& image_url, |
177 bool errored, | 178 bool errored, |
178 const SkBitmap& image) { | 179 const SkBitmap& image) { |
179 gfx::Image favicon(new SkBitmap(image)); | 180 gfx::Image favicon(new SkBitmap(image)); |
180 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 181 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
181 if (touch_icon_handler_.get()) | 182 if (touch_icon_handler_.get()) |
182 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 183 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
183 } | 184 } |
OLD | NEW |