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 #include "chrome/browser/chromeos/arc/arc_wallpaper_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_wallpaper_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/common/wallpaper/wallpaper_controller.h" | 9 #include "ash/common/wallpaper/wallpaper_controller.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 SetBitmapAsWallpaper(bitmap); | 134 SetBitmapAsWallpaper(bitmap); |
135 } | 135 } |
136 | 136 |
137 void ArcWallpaperService::OnDecodeImageFailed() { | 137 void ArcWallpaperService::OnDecodeImageFailed() { |
138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
139 LOG(ERROR) << "Failed to decode wallpaper image."; | 139 LOG(ERROR) << "Failed to decode wallpaper image."; |
140 } | 140 } |
141 | 141 |
142 void ArcWallpaperService::OnWallpaperDataChanged() { | 142 void ArcWallpaperService::OnWallpaperDataChanged() { |
143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
144 mojom::WallpaperInstance* instance = | 144 auto* wallpaper_instance = |
145 GetWallpaperInstance(kMinOnWallpaperChangedVersion); | 145 arc_bridge_service()->wallpaper()->GetInstanceForMethod( |
146 if (!instance) | 146 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); |
| 147 if (!wallpaper_instance) |
147 return; | 148 return; |
148 instance->OnWallpaperChanged(); | 149 wallpaper_instance->OnWallpaperChanged(); |
149 } | |
150 | |
151 mojom::WallpaperInstance* ArcWallpaperService::GetWallpaperInstance( | |
152 uint32_t min_version) { | |
153 uint32_t version = arc_bridge_service()->wallpaper()->version(); | |
154 if (version < min_version) { | |
155 VLOG(1) << "ARC wallpaper instance is too old. required: " << min_version | |
156 << ", actual: " << version; | |
157 return nullptr; | |
158 } | |
159 | |
160 mojom::WallpaperInstance* instance = | |
161 arc_bridge_service()->wallpaper()->instance(); | |
162 if (!instance) | |
163 VLOG(2) << "ARC wallpaper instance is not ready."; | |
164 return instance; | |
165 } | 150 } |
166 | 151 |
167 } // namespace arc | 152 } // namespace arc |
OLD | NEW |