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_
8 #include "ash/desktop_background/desktop_background_controller.h"
9 #include "extensions/browser/extension_function.h"
10 #include "ui/gfx/image/image_skia.h"
12 namespace wallpaper_api_util
{
13 ash::WallpaperLayout
GetLayoutEnum(const std::string
& layout
);
14 } // namespace wallpaper_api_util
16 // Wallpaper manager function base. It contains a image decoder to decode
18 class WallpaperFunctionBase
: public AsyncExtensionFunction
{
20 WallpaperFunctionBase();
23 virtual ~WallpaperFunctionBase();
25 // A class to decode JPEG file.
26 class UnsafeWallpaperDecoder
;
28 // Holds an instance of WallpaperDecoder.
29 static UnsafeWallpaperDecoder
* unsafe_wallpaper_decoder_
;
31 // Starts to decode |data|. Must run on UI thread.
32 void StartDecode(const std::string
& data
);
34 // Handles cancel case. No error message should be set.
37 // Handles failure case. Sets error message.
38 void OnFailure(const std::string
& error
);
41 virtual void OnWallpaperDecoded(const gfx::ImageSkia
& wallpaper
) = 0;
44 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_