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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_favicon_loader.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/ui/ash/launcher/launcher_favicon_loader.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/ui/ash/launcher/browser_launcher_item_controller.h" 9 #include "chrome/browser/ui/ash/launcher/browser_launcher_item_controller.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/common/content_constants.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
15 16
16 namespace internal { 17 namespace internal {
17 18
18 const int kMaxBitmapSize = 256; 19 const int kMaxBitmapSize = 256;
19 20
20 //////////////////////////////////////////////////////////////////////////////// 21 ////////////////////////////////////////////////////////////////////////////////
21 // FaviconBitmapHandler fetchs all bitmaps with the 'icon' (or 'shortcut icon') 22 // FaviconBitmapHandler fetchs all bitmaps with the 'icon' (or 'shortcut icon')
22 // link tag, storing the one that best matches ash::kLauncherPreferredSize. 23 // link tag, storing the one that best matches ash::kLauncherPreferredSize.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bitmap_.reset(); 103 bitmap_.reset();
103 } 104 }
104 // Request any new urls. 105 // Request any new urls.
105 for (std::set<GURL>::iterator iter = urls.begin(); 106 for (std::set<GURL>::iterator iter = urls.begin();
106 iter != urls.end(); ++iter) { 107 iter != urls.end(); ++iter) {
107 if (processed_requests_.find(*iter) != processed_requests_.end()) 108 if (processed_requests_.find(*iter) != processed_requests_.end())
108 continue; // Skip already processed downloads. 109 continue; // Skip already processed downloads.
109 if (pending_requests_.find(*iter) != pending_requests_.end()) 110 if (pending_requests_.find(*iter) != pending_requests_.end())
110 continue; // Skip already pending downloads. 111 continue; // Skip already pending downloads.
111 pending_requests_.insert(*iter); 112 pending_requests_.insert(*iter);
112 web_contents_->DownloadFavicon(*iter, 0, 113 web_contents_->DownloadFavicon(*iter,
114 content::DOWNLOAD_FAVICON, 0,
113 base::Bind(&FaviconBitmapHandler::DidDownloadFavicon, 115 base::Bind(&FaviconBitmapHandler::DidDownloadFavicon,
114 weak_ptr_factory_.GetWeakPtr())); 116 weak_ptr_factory_.GetWeakPtr()));
115 } 117 }
116 } 118 }
117 119
118 bool FaviconBitmapHandler::HasPendingDownloads() const { 120 bool FaviconBitmapHandler::HasPendingDownloads() const {
119 return !pending_requests_.empty(); 121 return !pending_requests_.empty();
120 } 122 }
121 123
122 void FaviconBitmapHandler::DidDownloadFavicon( 124 void FaviconBitmapHandler::DidDownloadFavicon(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 LauncherFaviconLoader::~LauncherFaviconLoader() { 170 LauncherFaviconLoader::~LauncherFaviconLoader() {
169 } 171 }
170 172
171 SkBitmap LauncherFaviconLoader::GetFavicon() const { 173 SkBitmap LauncherFaviconLoader::GetFavicon() const {
172 return favicon_handler_->bitmap(); 174 return favicon_handler_->bitmap();
173 } 175 }
174 176
175 bool LauncherFaviconLoader::HasPendingDownloads() const { 177 bool LauncherFaviconLoader::HasPendingDownloads() const {
176 return favicon_handler_->HasPendingDownloads(); 178 return favicon_handler_->HasPendingDownloads();
177 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698