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 "components/favicon/core/favicon_handler.h" | 5 #include "components/favicon/core/favicon_handler.h" |
6 | 6 |
7 #include<set> | 7 #include<set> |
8 #include<vector> | 8 #include<vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 const GURL& icon_url, | 398 const GURL& icon_url, |
399 favicon_base::IconType icon_type, | 399 favicon_base::IconType icon_type, |
400 const gfx::Image& image) override { | 400 const gfx::Image& image) override { |
401 scoped_refptr<base::RefCountedMemory> bytes = image.As1xPNGBytes(); | 401 scoped_refptr<base::RefCountedMemory> bytes = image.As1xPNGBytes(); |
402 std::vector<unsigned char> bitmap_data(bytes->front(), | 402 std::vector<unsigned char> bitmap_data(bytes->front(), |
403 bytes->front() + bytes->size()); | 403 bytes->front() + bytes->size()); |
404 history_handler_.reset(new HistoryRequestHandler( | 404 history_handler_.reset(new HistoryRequestHandler( |
405 page_url, icon_url, icon_type, bitmap_data, image.Size())); | 405 page_url, icon_url, icon_type, bitmap_data, image.Size())); |
406 } | 406 } |
407 | 407 |
408 bool ShouldSaveFavicon(const GURL& url) override { return true; } | 408 bool ShouldSaveFavicon() override { return true; } |
409 | 409 |
410 GURL page_url_; | 410 GURL page_url_; |
411 | 411 |
412 private: | 412 private: |
413 | 413 |
414 // The unique id of a download request. It will be returned to a | 414 // The unique id of a download request. It will be returned to a |
415 // FaviconHandler. | 415 // FaviconHandler. |
416 int download_id_; | 416 int download_id_; |
417 | 417 |
418 scoped_ptr<DownloadHandler> download_handler_; | 418 scoped_ptr<DownloadHandler> download_handler_; |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 EXPECT_FALSE(driver1.update_active_favicon()); | 1705 EXPECT_FALSE(driver1.update_active_favicon()); |
1706 EXPECT_EQ(3u, driver1.num_favicon_available()); | 1706 EXPECT_EQ(3u, driver1.num_favicon_available()); |
1707 } | 1707 } |
1708 | 1708 |
1709 INSTANTIATE_TEST_CASE_P(FaviconHandlerTestActiveFaviconValidityTrueOrFalse, | 1709 INSTANTIATE_TEST_CASE_P(FaviconHandlerTestActiveFaviconValidityTrueOrFalse, |
1710 FaviconHandlerActiveFaviconValidityParamTest, | 1710 FaviconHandlerActiveFaviconValidityParamTest, |
1711 ::testing::Bool()); | 1711 ::testing::Bool()); |
1712 | 1712 |
1713 } // namespace | 1713 } // namespace |
1714 } // namespace favicon | 1714 } // namespace favicon |
OLD | NEW |