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( | |
45 const base::Callback<void(mojo::Array<uint8_t>)>& callback) override; | |
hidehiko
2016/09/07 01:16:25
could you use "const GetWallpaperCallback&"?
| |
46 | |
47 // SetWallpaperDelegate implementation. | |
48 void SetWallpaperJPEG(const std::vector<uint8_t>& jpeg_data) override; | |
49 // ImageDecoder::ImageRequest implementation. | |
50 void OnImageDecoded(const SkBitmap& bitmap) override; | |
51 void OnDecodeImageFailed() override; | |
52 | |
53 private: | |
54 mojo::Binding<mojom::WallpaperHost> binding_; | |
55 DISALLOW_COPY_AND_ASSIGN(ArcWallpaperService); | |
56 }; | |
57 | |
58 } // namespace arc | |
59 | |
60 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_ | |
OLD | NEW |