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