OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_ARC_ARC_WALLPAPER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 #include <set> |
| 12 #include <vector> |
| 13 |
| 14 #include "base/macros.h" |
| 15 #include "chrome/browser/image_decoder.h" |
| 16 #include "components/arc/arc_service.h" |
| 17 #include "components/arc/common/wallpaper.mojom.h" |
| 18 #include "components/arc/instance_holder.h" |
| 19 #include "components/arc/set_wallpaper_delegate.h" |
| 20 #include "mojo/public/cpp/bindings/binding.h" |
| 21 |
| 22 class SkBitmap; |
| 23 |
| 24 namespace arc { |
| 25 |
| 26 // Lives on the UI thread. |
| 27 class ArcWallpaperService |
| 28 : public ArcService, |
| 29 public SetWallpaperDelegate, |
| 30 public ImageDecoder::ImageRequest, |
| 31 public InstanceHolder<mojom::WallpaperInstance>::Observer, |
| 32 public mojom::WallpaperHost { |
| 33 public: |
| 34 explicit ArcWallpaperService(ArcBridgeService* bridge_service); |
| 35 ~ArcWallpaperService() override; |
| 36 |
| 37 // InstanceHolder<mojom::WallpaperInstance>::Observer overrides. |
| 38 void OnInstanceReady() override; |
| 39 |
| 40 // mojom::WallpaperHost overrides. |
| 41 // TODO(muyuanli): change callback prototype when use_new_wrapper_types is |
| 42 // updated and merge them with the functions below. |
| 43 void SetWallpaper(mojo::Array<uint8_t> png_data) override; |
| 44 void GetWallpaper(const GetWallpaperCallback& callback) override; |
| 45 |
| 46 // SetWallpaperDelegate implementation. |
| 47 void SetWallpaperJpeg(const std::vector<uint8_t>& jpeg_data) override; |
| 48 // ImageDecoder::ImageRequest implementation. |
| 49 void OnImageDecoded(const SkBitmap& bitmap) override; |
| 50 void OnDecodeImageFailed() override; |
| 51 |
| 52 private: |
| 53 mojo::Binding<mojom::WallpaperHost> binding_; |
| 54 DISALLOW_COPY_AND_ASSIGN(ArcWallpaperService); |
| 55 }; |
| 56 |
| 57 } // namespace arc |
| 58 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_ |
OLD | NEW |