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

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

Issue 12945007: Fix Notifications Icon loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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"
26 #include "content/public/common/content_constants.h"
26 #include "ui/gfx/codec/png_codec.h" 27 #include "ui/gfx/codec/png_codec.h"
27 #include "ui/gfx/image/image.h" 28 #include "ui/gfx/image/image.h"
28 #include "ui/gfx/image/image_skia.h" 29 #include "ui/gfx/image/image_skia.h"
29 #include "ui/gfx/image/image_skia_rep.h" 30 #include "ui/gfx/image/image_skia_rep.h"
30 31
31 using content::FaviconStatus; 32 using content::FaviconStatus;
32 using content::NavigationController; 33 using content::NavigationController;
33 using content::NavigationEntry; 34 using content::NavigationEntry;
34 using content::WebContents; 35 using content::WebContents;
35 36
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 126 }
126 service->SetFavicons(entry->GetURL(), favicon.url, history::FAVICON, 127 service->SetFavicons(entry->GetURL(), favicon.url, history::FAVICON,
127 favicon.image); 128 favicon.image);
128 } 129 }
129 130
130 NavigationEntry* FaviconTabHelper::GetActiveEntry() { 131 NavigationEntry* FaviconTabHelper::GetActiveEntry() {
131 return web_contents()->GetController().GetActiveEntry(); 132 return web_contents()->GetController().GetActiveEntry();
132 } 133 }
133 134
134 int FaviconTabHelper::StartDownload(const GURL& url, int image_size) { 135 int FaviconTabHelper::StartDownload(const GURL& url, int image_size) {
135 return web_contents()->DownloadFavicon(url, image_size, 136 return web_contents()->DownloadFavicon(
136 base::Bind(&FaviconTabHelper::DidDownloadFavicon, 137 url,
137 base::Unretained(this))); 138 content::DOWNLOAD_FAVICON,
139 image_size,
140 base::Bind(&FaviconTabHelper::DidDownloadFavicon,base::Unretained(this)));
138 } 141 }
139 142
140 void FaviconTabHelper::NotifyFaviconUpdated(bool icon_url_changed) { 143 void FaviconTabHelper::NotifyFaviconUpdated(bool icon_url_changed) {
141 content::NotificationService::current()->Notify( 144 content::NotificationService::current()->Notify(
142 chrome::NOTIFICATION_FAVICON_UPDATED, 145 chrome::NOTIFICATION_FAVICON_UPDATED,
143 content::Source<WebContents>(web_contents()), 146 content::Source<WebContents>(web_contents()),
144 content::Details<bool>(&icon_url_changed)); 147 content::Details<bool>(&icon_url_changed));
145 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); 148 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB);
146 } 149 }
147 150
(...skipping 29 matching lines...) Expand all
177 const GURL& image_url, 180 const GURL& image_url,
178 int requested_size, 181 int requested_size,
179 const std::vector<SkBitmap>& bitmaps) { 182 const std::vector<SkBitmap>& bitmaps) {
180 favicon_handler_->OnDidDownloadFavicon( 183 favicon_handler_->OnDidDownloadFavicon(
181 id, image_url, requested_size, bitmaps); 184 id, image_url, requested_size, bitmaps);
182 if (touch_icon_handler_.get()) { 185 if (touch_icon_handler_.get()) {
183 touch_icon_handler_->OnDidDownloadFavicon( 186 touch_icon_handler_->OnDidDownloadFavicon(
184 id, image_url, requested_size, bitmaps); 187 id, image_url, requested_size, bitmaps);
185 } 188 }
186 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698