OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
| 7 |
| 8 #include "ash/desktop_background/desktop_background_resources.h" |
| 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 #include "net/url_request/url_fetcher_delegate.h" |
| 11 #include "ui/gfx/image/image_skia.h" |
| 12 |
| 13 // Wallpaper manager strings. |
| 14 class WallpaperStringsFunction : public SyncExtensionFunction { |
| 15 public: |
| 16 DECLARE_EXTENSION_FUNCTION_NAME("wallpaperPrivate.getStrings"); |
| 17 |
| 18 protected: |
| 19 virtual ~WallpaperStringsFunction() {} |
| 20 |
| 21 // SyncExtensionFunction overrides. |
| 22 virtual bool RunImpl() OVERRIDE; |
| 23 }; |
| 24 |
| 25 class WallpaperSetWallpaperFunction : public AsyncExtensionFunction { |
| 26 public: |
| 27 DECLARE_EXTENSION_FUNCTION_NAME("wallpaperPrivate.setWallpaper"); |
| 28 |
| 29 WallpaperSetWallpaperFunction(); |
| 30 |
| 31 protected: |
| 32 virtual ~WallpaperSetWallpaperFunction(); |
| 33 |
| 34 // AsyncExtensionFunction overrides. |
| 35 virtual bool RunImpl() OVERRIDE; |
| 36 |
| 37 private: |
| 38 class WallpaperDecoder; |
| 39 |
| 40 void OnWallpaperDecoded(const gfx::ImageSkia& wallpaper); |
| 41 void OnFail(); |
| 42 |
| 43 // Saves the image data to a file. |
| 44 void SaveToFile(); |
| 45 |
| 46 // Sets wallpaper to the decoded image. |
| 47 void SetDecodedWallpaper(); |
| 48 |
| 49 // Layout of the downloaded wallpaper. |
| 50 ash::WallpaperLayout layout_; |
| 51 |
| 52 // The decoded wallpaper. |
| 53 gfx::ImageSkia wallpaper_; |
| 54 |
| 55 // Email address of logged in user. |
| 56 std::string email_; |
| 57 |
| 58 // File name extracts from URL. |
| 59 std::string file_name_; |
| 60 |
| 61 // String representation of downloaded wallpaper. |
| 62 std::string image_data_; |
| 63 |
| 64 // Holds an instance of WallpaperDecoder. |
| 65 static WallpaperDecoder* wallpaper_decoder_; |
| 66 }; |
| 67 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_WALLPAPER_PRIVATE_API_H_ |
OLD | NEW |