| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_ | |
| 6 #define COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "components/keyed_service/core/keyed_service.h" | |
| 12 | |
| 13 class GURL; | |
| 14 | |
| 15 namespace gfx { | |
| 16 class Canvas; | |
| 17 } | |
| 18 | |
| 19 namespace favicon_base { | |
| 20 struct FallbackIconStyle; | |
| 21 } | |
| 22 | |
| 23 namespace favicon { | |
| 24 | |
| 25 class FallbackIconClient; | |
| 26 | |
| 27 // A service to provide methods to render fallback favicons. | |
| 28 class FallbackIconService : public KeyedService { | |
| 29 public: | |
| 30 explicit FallbackIconService(FallbackIconClient* fallback_icon_client); | |
| 31 ~FallbackIconService() override; | |
| 32 | |
| 33 // Renders a fallback icon synchronously and returns the bitmap. Returns an | |
| 34 // empty std::vector on failure. |size| is icon width and height in pixels. | |
| 35 std::vector<unsigned char> RenderFallbackIconBitmap( | |
| 36 const GURL& icon_url, | |
| 37 int size, | |
| 38 const favicon_base::FallbackIconStyle& style); | |
| 39 | |
| 40 private: | |
| 41 // Renders a fallback icon on |canvas| at position (|x|, |y|). |size| is icon | |
| 42 // width and height in pixels. | |
| 43 void DrawFallbackIcon(const GURL& icon_url, | |
| 44 int size, | |
| 45 const favicon_base::FallbackIconStyle& style, | |
| 46 gfx::Canvas* canvas); | |
| 47 | |
| 48 FallbackIconClient* fallback_icon_client_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(FallbackIconService); | |
| 51 }; | |
| 52 | |
| 53 } // namespace favicon | |
| 54 | |
| 55 #endif // COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_ | |
| OLD | NEW |