1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_
11 #include "ash/desktop_background/desktop_background_controller.h"
12 #include "components/wallpaper/wallpaper_layout.h"
13 #include "extensions/browser/extension_function.h"
14 #include "ui/gfx/image/image_skia.h"
16 namespace wallpaper_api_util
{
17 extern const char kCancelWallpaperMessage
[];
18 wallpaper::WallpaperLayout
GetLayoutEnum(const std::string
& layout
);
19 } // namespace wallpaper_api_util
21 // Wallpaper manager function base. It contains a image decoder to decode
23 class WallpaperFunctionBase
: public AsyncExtensionFunction
{
25 WallpaperFunctionBase();
28 ~WallpaperFunctionBase() override
;
30 // A class to decode JPEG file.
31 class UnsafeWallpaperDecoder
;
33 // Holds an instance of WallpaperDecoder.
34 static UnsafeWallpaperDecoder
* unsafe_wallpaper_decoder_
;
36 // Starts to decode |data|. Must run on UI thread.
37 void StartDecode(const std::vector
<char>& data
);
39 // Handles cancel case. No error message should be set.
42 // Handles failure case. Sets error message.
43 void OnFailure(const std::string
& error
);
46 virtual void OnWallpaperDecoded(const gfx::ImageSkia
& wallpaper
) = 0;
49 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_