Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: chrome/browser/chromeos/arc/arc_wallpaper_service.h

Issue 2345153002: cheets: add wallpaper observer to arc_wallpaper_service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "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
23 namespace arc { 24 namespace arc {
24 25
25 // Lives on the UI thread. 26 // Lives on the UI thread.
26 class ArcWallpaperService 27 class ArcWallpaperService
27 : public ArcService, 28 : public ArcService,
29 public ash::WallpaperControllerObserver,
28 public ImageDecoder::ImageRequest, 30 public ImageDecoder::ImageRequest,
29 public InstanceHolder<mojom::WallpaperInstance>::Observer, 31 public InstanceHolder<mojom::WallpaperInstance>::Observer,
30 public mojom::WallpaperHost { 32 public mojom::WallpaperHost {
31 public: 33 public:
32 explicit ArcWallpaperService(ArcBridgeService* bridge_service); 34 explicit ArcWallpaperService(ArcBridgeService* bridge_service);
33 ~ArcWallpaperService() override; 35 ~ArcWallpaperService() override;
34 36
35 // InstanceHolder<mojom::WallpaperInstance>::Observer overrides. 37 // InstanceHolder<mojom::WallpaperInstance>::Observer overrides.
36 void OnInstanceReady() override; 38 void OnInstanceReady() override;
37 39
38 // mojom::WallpaperHost overrides. 40 // mojom::WallpaperHost overrides.
39 // TODO(muyuanli): change callback prototype when use_new_wrapper_types is 41 // TODO(muyuanli): change callback prototype when use_new_wrapper_types is
40 // updated and merge them with the functions below. 42 // updated and merge them with the functions below.
41 void SetWallpaper(mojo::Array<uint8_t> png_data) override; 43 void SetWallpaper(mojo::Array<uint8_t> png_data) override;
42 void GetWallpaper(const GetWallpaperCallback& callback) override; 44 void GetWallpaper(const GetWallpaperCallback& callback) override;
43 45
44 // ImageDecoder::ImageRequest implementation. 46 // ImageDecoder::ImageRequest implementation.
45 void OnImageDecoded(const SkBitmap& bitmap) override; 47 void OnImageDecoded(const SkBitmap& bitmap) override;
46 void OnDecodeImageFailed() override; 48 void OnDecodeImageFailed() override;
47 49
50 // WallpaperControllerObserver implementation.
51 void OnWallpaperDataChanged() override;
52
48 private: 53 private:
54 bool CheckWallpaperInstanceVersion(uint32_t version_need);
55
49 mojo::Binding<mojom::WallpaperHost> binding_; 56 mojo::Binding<mojom::WallpaperHost> binding_;
50 DISALLOW_COPY_AND_ASSIGN(ArcWallpaperService); 57 DISALLOW_COPY_AND_ASSIGN(ArcWallpaperService);
51 }; 58 };
52 59
53 } // namespace arc 60 } // namespace arc
54 61
55 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_ 62 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_WALLPAPER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698