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/wallpaper/arc_wallpaper_service.h" | 5 #include "chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 | 10 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 const PrimaryAccount& account = GetPrimaryAccount(); | 214 const PrimaryAccount& account = GetPrimaryAccount(); |
215 chromeos::WallpaperManager::Get()->SetDefaultWallpaper(account.id, | 215 chromeos::WallpaperManager::Get()->SetDefaultWallpaper(account.id, |
216 account.is_active); | 216 account.is_active); |
217 } | 217 } |
218 | 218 |
219 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { | 219 void ArcWallpaperService::GetWallpaper(const GetWallpaperCallback& callback) { |
220 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 220 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
221 ash::WallpaperController* wc = ash::Shell::Get()->wallpaper_controller(); | 221 ash::WallpaperController* wc = ash::Shell::Get()->wallpaper_controller(); |
222 gfx::ImageSkia wallpaper = wc->GetWallpaper(); | 222 gfx::ImageSkia wallpaper = wc->GetWallpaper(); |
223 base::PostTaskWithTraitsAndReplyWithResult( | 223 base::PostTaskWithTraitsAndReplyWithResult( |
224 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 224 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
225 base::TaskPriority::BACKGROUND), | |
226 base::Bind(&EncodeImagePng, wallpaper), callback); | 225 base::Bind(&EncodeImagePng, wallpaper), callback); |
227 } | 226 } |
228 | 227 |
229 void ArcWallpaperService::OnWallpaperDataChanged() { | 228 void ArcWallpaperService::OnWallpaperDataChanged() { |
230 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 229 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
231 | 230 |
232 auto* const wallpaper_instance = ARC_GET_INSTANCE_FOR_METHOD( | 231 auto* const wallpaper_instance = ARC_GET_INSTANCE_FOR_METHOD( |
233 arc_bridge_service()->wallpaper(), OnWallpaperChanged); | 232 arc_bridge_service()->wallpaper(), OnWallpaperChanged); |
234 const ash::WallpaperController* const wc = GetWallpaperController(); | 233 const ash::WallpaperController* const wc = GetWallpaperController(); |
235 const int32_t android_id = | 234 const int32_t android_id = |
236 wc ? android_id_store_->Pop(wc->GetWallpaperOriginalImageId()) : -1; | 235 wc ? android_id_store_->Pop(wc->GetWallpaperOriginalImageId()) : -1; |
237 if (!wallpaper_instance) | 236 if (!wallpaper_instance) |
238 return; | 237 return; |
239 wallpaper_instance->OnWallpaperChanged(android_id); | 238 wallpaper_instance->OnWallpaperChanged(android_id); |
240 } | 239 } |
241 | 240 |
242 } // namespace arc | 241 } // namespace arc |
OLD | NEW |