Chromium Code Reviews| 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> |
|
Yusuke Sato
2016/09/16 21:23:50
nit: this seems unnecessary (line 10-12)
Muyuan
2016/09/16 21:38:48
Done.
| |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/common/wallpaper/wallpaper_controller_observer.h" | |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "chrome/browser/image_decoder.h" | 16 #include "chrome/browser/image_decoder.h" |
| 16 #include "components/arc/arc_service.h" | 17 #include "components/arc/arc_service.h" |
| 17 #include "components/arc/common/wallpaper.mojom.h" | 18 #include "components/arc/common/wallpaper.mojom.h" |
| 18 #include "components/arc/instance_holder.h" | 19 #include "components/arc/instance_holder.h" |
| 19 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
| 20 | 21 |
| 21 class SkBitmap; | 22 class SkBitmap; |
| 22 | 23 |
| 24 namespace ash { | |
| 25 | |
| 26 class WallpaperController; | |
| 27 | |
| 28 } // ash | |
| 29 | |
| 23 namespace arc { | 30 namespace arc { |
| 24 | 31 |
| 25 // Lives on the UI thread. | 32 // Lives on the UI thread. |
| 26 class ArcWallpaperService | 33 class ArcWallpaperService |
| 27 : public ArcService, | 34 : public ArcService, |
| 35 public ash::WallpaperControllerObserver, | |
| 28 public ImageDecoder::ImageRequest, | 36 public ImageDecoder::ImageRequest, |
| 29 public InstanceHolder<mojom::WallpaperInstance>::Observer, | 37 public InstanceHolder<mojom::WallpaperInstance>::Observer, |
| 30 public mojom::WallpaperHost { | 38 public mojom::WallpaperHost { |
| 31 public: | 39 public: |
| 32 explicit ArcWallpaperService(ArcBridgeService* bridge_service); | 40 explicit ArcWallpaperService(ArcBridgeService* bridge_service); |
| 33 ~ArcWallpaperService() override; | 41 ~ArcWallpaperService() override; |
| 34 | 42 |
| 35 // InstanceHolder<mojom::WallpaperInstance>::Observer overrides. | 43 // InstanceHolder<mojom::WallpaperInstance>::Observer overrides. |
| 36 void OnInstanceReady() override; | 44 void OnInstanceReady() override; |
| 45 void OnInstanceClosed() override; | |
| 37 | 46 |
| 38 // mojom::WallpaperHost overrides. | 47 // mojom::WallpaperHost overrides. |
| 39 // TODO(muyuanli): change callback prototype when use_new_wrapper_types is | 48 // TODO(muyuanli): change callback prototype when use_new_wrapper_types is |
| 40 // updated and merge them with the functions below. | 49 // updated and merge them with the functions below. |
| 41 void SetWallpaper(mojo::Array<uint8_t> png_data) override; | 50 void SetWallpaper(mojo::Array<uint8_t> png_data) override; |
| 42 void GetWallpaper(const GetWallpaperCallback& callback) override; | 51 void GetWallpaper(const GetWallpaperCallback& callback) override; |
| 43 | 52 |
| 44 // ImageDecoder::ImageRequest implementation. | 53 // ImageDecoder::ImageRequest implementation. |
| 45 void OnImageDecoded(const SkBitmap& bitmap) override; | 54 void OnImageDecoded(const SkBitmap& bitmap) override; |
| 46 void OnDecodeImageFailed() override; | 55 void OnDecodeImageFailed() override; |
| 47 | 56 |
| 57 // WallpaperControllerObserver implementation. | |
| 58 void OnWallpaperDataChanged() override; | |
| 59 | |
| 48 private: | 60 private: |
| 61 ash::WallpaperController* GetWallpaperController(); | |
| 62 mojom::WallpaperInstance* GetWallpaperInstance(uint32_t min_version); | |
| 63 | |
| 49 mojo::Binding<mojom::WallpaperHost> binding_; | 64 mojo::Binding<mojom::WallpaperHost> binding_; |
| 50 DISALLOW_COPY_AND_ASSIGN(ArcWallpaperService); | 65 DISALLOW_COPY_AND_ASSIGN(ArcWallpaperService); |
| 51 }; | 66 }; |
| 52 | 67 |
| 53 } // namespace arc | 68 } // namespace arc |
| 54 | 69 |
| 55 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_ | 70 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_ |
| OLD | NEW |