| OLD | NEW |
| 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" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 bool HasPendingDownloads() const; | 40 bool HasPendingDownloads() const; |
| 41 | 41 |
| 42 // content::WebContentObserver implementation. | 42 // content::WebContentObserver implementation. |
| 43 virtual void DidUpdateFaviconURL( | 43 virtual void DidUpdateFaviconURL( |
| 44 int32 page_id, | 44 int32 page_id, |
| 45 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 45 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 void DidDownloadFavicon( | 48 void DidDownloadFavicon( |
| 49 int id, | 49 int id, |
| 50 int http_status_code, |
| 50 const GURL& image_url, | 51 const GURL& image_url, |
| 51 int requested_size, | 52 int requested_size, |
| 52 const std::vector<SkBitmap>& bitmaps); | 53 const std::vector<SkBitmap>& bitmaps); |
| 53 | 54 |
| 54 void AddFavicon(const GURL& image_url, const SkBitmap& new_bitmap); | 55 void AddFavicon(const GURL& image_url, const SkBitmap& new_bitmap); |
| 55 | 56 |
| 56 LauncherFaviconLoader::Delegate* delegate_; | 57 LauncherFaviconLoader::Delegate* delegate_; |
| 57 | 58 |
| 58 content::WebContents* web_contents_; | 59 content::WebContents* web_contents_; |
| 59 | 60 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 weak_ptr_factory_.GetWeakPtr())); | 115 weak_ptr_factory_.GetWeakPtr())); |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 bool FaviconBitmapHandler::HasPendingDownloads() const { | 119 bool FaviconBitmapHandler::HasPendingDownloads() const { |
| 119 return !pending_requests_.empty(); | 120 return !pending_requests_.empty(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void FaviconBitmapHandler::DidDownloadFavicon( | 123 void FaviconBitmapHandler::DidDownloadFavicon( |
| 123 int id, | 124 int id, |
| 125 int http_status_code, |
| 124 const GURL& image_url, | 126 const GURL& image_url, |
| 125 int requested_size, | 127 int requested_size, |
| 126 const std::vector<SkBitmap>& bitmaps) { | 128 const std::vector<SkBitmap>& bitmaps) { |
| 127 UrlSet::iterator iter = pending_requests_.find(image_url); | 129 UrlSet::iterator iter = pending_requests_.find(image_url); |
| 128 if (iter == pending_requests_.end()) { | 130 if (iter == pending_requests_.end()) { |
| 129 // Updates are received for all downloads; ignore unrequested urls. | 131 // Updates are received for all downloads; ignore unrequested urls. |
| 130 return; | 132 return; |
| 131 } | 133 } |
| 132 pending_requests_.erase(iter); | 134 pending_requests_.erase(iter); |
| 133 | 135 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |