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.
5 #ifndef COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_
6 #define COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_
10 #include "base/macros.h"
11 #include "components/keyed_service/core/keyed_service.h"
19 namespace favicon_base
{
20 struct FallbackIconStyle
;
25 class FallbackIconClient
;
27 // A service to provide methods to render fallback favicons.
28 class FallbackIconService
: public KeyedService
{
30 explicit FallbackIconService(FallbackIconClient
* fallback_icon_client
);
31 ~FallbackIconService() override
;
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(
38 const favicon_base::FallbackIconStyle
& style
);
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
,
45 const favicon_base::FallbackIconStyle
& style
,
48 FallbackIconClient
* fallback_icon_client_
;
50 DISALLOW_COPY_AND_ASSIGN(FallbackIconService
);
53 } // namespace favicon
55 #endif // COMPONENTS_FAVICON_CORE_FALLBACK_ICON_SERVICE_H_