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

Side by Side Diff: components/arc/wallpaper/arc_wallpaper_bridge.cc

Issue 2264743002: cheets: implement cros side of WallpaperManagerService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cheets: implement cros side of WallpaperManagerService. Created 4 years, 4 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
(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 #include "components/arc/wallpaper/arc_wallpaper_bridge.h"
6
7 #include <vector>
8
9 #include "base/threading/thread_checker.h"
xiyuan 2016/08/19 23:04:07 This should be moved to header file since we decla
Muyuan 2016/08/22 22:25:00 Done.
10
11
12 namespace arc {
13
14 ArcWallpaperBridge::ArcWallpaperBridge(ArcBridgeService* bridge_service,
15 const
16 std::shared_ptr<SetWallpaperDelegate>&
xiyuan 2016/08/19 23:04:07 nit: The format looks wrong. Can you run "git cl f
Muyuan 2016/08/22 22:25:00 Done.
17 delegate)
18 : ArcService(bridge_service),
19 wallpaper_delegate_(delegate),
20 binding_(this) {
21 arc_bridge_service()->wallpaper()->AddObserver(this);
22 }
23
24 ArcWallpaperBridge::~ArcWallpaperBridge() {
25 DCHECK(thread_checker_.CalledOnValidThread());
xiyuan 2016/08/19 23:04:07 #include "base/logging.h"
Muyuan 2016/08/22 22:25:00 Done.
26 arc_bridge_service()->wallpaper()->RemoveObserver(this);
27 }
28
29 void ArcWallpaperBridge::OnInstanceReady() {
30 mojom::WallpaperInstance* wallpaper_instance =
31 arc_bridge_service()->wallpaper()->instance();
32 if (!wallpaper_instance) {
33 LOG(ERROR) << "OnWallpaperInstanceReady called, "
34 << "but no wallpaper instance found";
35 return;
36 }
37 wallpaper_instance->Init(binding_.CreateInterfacePtrAndBind());
38 }
39
40 void ArcWallpaperBridge::SetWallpaper(mojo::Array<uint8_t> jpeg_data) {
41 DCHECK(thread_checker_.CalledOnValidThread());
42 wallpaper_delegate_->SetWallpaper(jpeg_data.PassStorage());
43 }
44
45 void ArcWallpaperBridge::GetWallpaper(
46 const base::Callback<void(mojo::Array<uint8_t>)>& callback) {
47 std::vector<uint8_t> image = wallpaper_delegate_->GetWallpaper();
48 callback.Run(std::move(image));
49 }
50
51 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698