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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/first_run/first_run_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chrome_notification_types.h"
12 #include "chrome/common/icon_messages.h" 12 #include "chrome/common/icon_messages.h"
13 #include "content/browser/renderer_host/render_view_host.h" 13 #include "content/browser/renderer_host/render_view_host.h"
14 #include "content/browser/tab_contents/navigation_controller.h" 14 #include "content/browser/tab_contents/navigation_controller.h"
15 #include "content/browser/tab_contents/navigation_details.h" 15 #include "content/browser/tab_contents/navigation_details.h"
16 #include "content/browser/tab_contents/tab_contents_delegate.h" 16 #include "content/browser/tab_contents/tab_contents_delegate.h"
17 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/browser/webui/web_ui.h" 18 #include "content/browser/webui/web_ui.h"
19 #include "content/common/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "ui/gfx/codec/png_codec.h" 20 #include "ui/gfx/codec/png_codec.h"
21 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
22 22
23 FaviconTabHelper::FaviconTabHelper(TabContents* tab_contents) 23 FaviconTabHelper::FaviconTabHelper(TabContents* tab_contents)
24 : TabContentsObserver(tab_contents), 24 : TabContentsObserver(tab_contents),
25 profile_(Profile::FromBrowserContext(tab_contents->browser_context())) { 25 profile_(Profile::FromBrowserContext(tab_contents->browser_context())) {
26 favicon_handler_.reset(new FaviconHandler(profile_, this, 26 favicon_handler_.reset(new FaviconHandler(profile_, this,
27 FaviconHandler::FAVICON)); 27 FaviconHandler::FAVICON));
28 if (chrome::kEnableTouchIcon) 28 if (chrome::kEnableTouchIcon)
29 touch_icon_handler_.reset(new FaviconHandler(profile_, this, 29 touch_icon_handler_.reset(new FaviconHandler(profile_, this,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return tab_contents()->controller().GetActiveEntry(); 131 return tab_contents()->controller().GetActiveEntry();
132 } 132 }
133 133
134 void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) { 134 void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) {
135 RenderViewHost* host = tab_contents()->render_view_host(); 135 RenderViewHost* host = tab_contents()->render_view_host();
136 host->Send(new IconMsg_DownloadFavicon( 136 host->Send(new IconMsg_DownloadFavicon(
137 host->routing_id(), id, url, image_size)); 137 host->routing_id(), id, url, image_size));
138 } 138 }
139 139
140 void FaviconTabHelper::NotifyFaviconUpdated() { 140 void FaviconTabHelper::NotifyFaviconUpdated() {
141 NotificationService::current()->Notify( 141 content::NotificationService::current()->Notify(
142 chrome::NOTIFICATION_FAVICON_UPDATED, 142 chrome::NOTIFICATION_FAVICON_UPDATED,
143 content::Source<TabContents>(tab_contents()), 143 content::Source<TabContents>(tab_contents()),
144 NotificationService::NoDetails()); 144 content::NotificationService::NoDetails());
145 tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); 145 tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB);
146 } 146 }
147 147
148 void FaviconTabHelper::NavigateToPendingEntry( 148 void FaviconTabHelper::NavigateToPendingEntry(
149 const GURL& url, 149 const GURL& url,
150 NavigationController::ReloadType reload_type) { 150 NavigationController::ReloadType reload_type) {
151 if (reload_type != NavigationController::NO_RELOAD && 151 if (reload_type != NavigationController::NO_RELOAD &&
152 !profile_->IsOffTheRecord()) { 152 !profile_->IsOffTheRecord()) {
153 FaviconService* favicon_service = 153 FaviconService* favicon_service =
154 profile_->GetFaviconService(Profile::IMPLICIT_ACCESS); 154 profile_->GetFaviconService(Profile::IMPLICIT_ACCESS);
(...skipping 21 matching lines...) Expand all
176 176
177 void FaviconTabHelper::OnDidDownloadFavicon(int id, 177 void FaviconTabHelper::OnDidDownloadFavicon(int id,
178 const GURL& image_url, 178 const GURL& image_url,
179 bool errored, 179 bool errored,
180 const SkBitmap& image) { 180 const SkBitmap& image) {
181 gfx::Image favicon(new SkBitmap(image)); 181 gfx::Image favicon(new SkBitmap(image));
182 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); 182 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon);
183 if (touch_icon_handler_.get()) 183 if (touch_icon_handler_.get())
184 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); 184 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon);
185 } 185 }
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/first_run/first_run_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698