OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/favicon/core/favicon_driver_impl.h" | 5 #include "components/favicon/core/favicon_driver_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "components/bookmarks/browser/bookmark_model.h" | 10 #include "components/bookmarks/browser/bookmark_model.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 FaviconDriverImpl::~FaviconDriverImpl() { | 43 FaviconDriverImpl::~FaviconDriverImpl() { |
44 } | 44 } |
45 | 45 |
46 void FaviconDriverImpl::FetchFavicon(const GURL& url) { | 46 void FaviconDriverImpl::FetchFavicon(const GURL& url) { |
47 favicon_handler_->FetchFavicon(url); | 47 favicon_handler_->FetchFavicon(url); |
48 if (touch_icon_handler_.get()) | 48 if (touch_icon_handler_.get()) |
49 touch_icon_handler_->FetchFavicon(url); | 49 touch_icon_handler_->FetchFavicon(url); |
50 } | 50 } |
51 | 51 |
52 void FaviconDriverImpl::DidDownloadFavicon( | |
53 int id, | |
54 int http_status_code, | |
55 const GURL& image_url, | |
56 const std::vector<SkBitmap>& bitmaps, | |
57 const std::vector<gfx::Size>& original_bitmap_sizes) { | |
58 if (bitmaps.empty() && http_status_code == 404) { | |
59 DVLOG(1) << "Failed to Download Favicon:" << image_url; | |
60 if (favicon_service_) | |
61 favicon_service_->UnableToDownloadFavicon(image_url); | |
62 } | |
63 | |
64 favicon_handler_->OnDidDownloadFavicon(id, image_url, bitmaps, | |
65 original_bitmap_sizes); | |
66 if (touch_icon_handler_.get()) { | |
67 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, bitmaps, | |
68 original_bitmap_sizes); | |
69 } | |
70 } | |
71 | |
72 bool FaviconDriverImpl::IsBookmarked(const GURL& url) { | 52 bool FaviconDriverImpl::IsBookmarked(const GURL& url) { |
73 return bookmark_model_ && bookmark_model_->IsBookmarked(url); | 53 return bookmark_model_ && bookmark_model_->IsBookmarked(url); |
74 } | 54 } |
75 | 55 |
76 bool FaviconDriverImpl::HasPendingTasksForTest() { | 56 bool FaviconDriverImpl::HasPendingTasksForTest() { |
77 if (favicon_handler_->HasPendingTasksForTest()) | 57 if (favicon_handler_->HasPendingTasksForTest()) |
78 return true; | 58 return true; |
79 if (touch_icon_handler_ && touch_icon_handler_->HasPendingTasksForTest()) | 59 if (touch_icon_handler_ && touch_icon_handler_->HasPendingTasksForTest()) |
80 return true; | 60 return true; |
81 return false; | 61 return false; |
(...skipping 15 matching lines...) Expand all Loading... |
97 void FaviconDriverImpl::OnUpdateFaviconURL( | 77 void FaviconDriverImpl::OnUpdateFaviconURL( |
98 const GURL& page_url, | 78 const GURL& page_url, |
99 const std::vector<FaviconURL>& candidates) { | 79 const std::vector<FaviconURL>& candidates) { |
100 DCHECK(!candidates.empty()); | 80 DCHECK(!candidates.empty()); |
101 favicon_handler_->OnUpdateFaviconURL(page_url, candidates); | 81 favicon_handler_->OnUpdateFaviconURL(page_url, candidates); |
102 if (touch_icon_handler_.get()) | 82 if (touch_icon_handler_.get()) |
103 touch_icon_handler_->OnUpdateFaviconURL(page_url, candidates); | 83 touch_icon_handler_->OnUpdateFaviconURL(page_url, candidates); |
104 } | 84 } |
105 | 85 |
106 } // namespace favicon | 86 } // namespace favicon |
OLD | NEW |