ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / wallpaper_function_base.h
blob97c1691d73d4fceea28958d866ef54996243c72e
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 <string>
9 #include <vector>
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
22 // wallpaper data.
23 class WallpaperFunctionBase : public AsyncExtensionFunction {
24 public:
25 WallpaperFunctionBase();
27 protected:
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.
40 void OnCancel();
42 // Handles failure case. Sets error message.
43 void OnFailure(const std::string& error);
45 private:
46 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) = 0;
49 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_