Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / wallpaper_function_base.h
blobbc6a0f25f82da8fdb5f048ceaa1c3a1f0bf75286
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
17 // wallpaper data.
18 class WallpaperFunctionBase : public AsyncExtensionFunction {
19 public:
20 WallpaperFunctionBase();
22 protected:
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.
35 void OnCancel();
37 // Handles failure case. Sets error message.
38 void OnFailure(const std::string& error);
40 private:
41 virtual void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper) = 0;
44 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_FUNCTION_BASE_H_