Chromium Code Reviews| 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 #include "chrome/browser/chromeos/arc/arc_wallpaper_handler.h" | |
| 6 | |
| 7 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | |
| 8 #include "components/signin/core/account_id/account_id.h" | |
| 9 #include "components/user_manager/user_manager.h" | |
| 10 #include "components/wallpaper/wallpaper_files_id.h" | |
| 11 #include "components/wallpaper/wallpaper_layout.h" | |
| 12 #include "content/public/browser/browser_thread.h" | |
| 13 | |
| 14 namespace arc { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 const char kAndroidWallpaperFilename[] = "android.jpg"; | |
| 19 | |
| 20 } // namespace | |
| 21 | |
| 22 void ArcWallpaperHandler::SetWallpaper(const gfx::ImageSkia& image) { | |
| 23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 24 | |
| 25 chromeos::WallpaperManager* wallpaper_manager = | |
| 26 chromeos::WallpaperManager::Get(); | |
| 27 | |
| 28 const AccountId& account_id = | |
| 29 user_manager::UserManager::Get()->GetPrimaryUser()->GetAccountId(); | |
| 30 wallpaper::WallpaperFilesId wallpaper_files_id = | |
| 31 wallpaper_manager->GetFilesId(account_id); | |
| 32 bool update_wallpaper = | |
| 33 account_id == | |
| 34 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); | |
| 35 // TODO: Allow specifying layout. | |
|
hidehiko
2016/06/14 13:44:16
TODO(nya) or TODO(bug-id)
Shuhei Takahashi
2016/06/14 14:08:39
Done.
| |
| 36 wallpaper_manager->SetCustomWallpaper( | |
| 37 account_id, wallpaper_files_id, kAndroidWallpaperFilename, | |
| 38 wallpaper::WALLPAPER_LAYOUT_STRETCH, user_manager::User::CUSTOMIZED, | |
| 39 image, update_wallpaper); | |
| 40 | |
| 41 // TODO: Register the wallpaper to Chrome OS wallpaper picker; currently | |
| 42 // the new wallpaper does not appear there. The best way to make this happen | |
| 43 // seems to refactor thumbnail generation logic in wallpaper_api.cc and | |
| 44 // wallpaper_private_api.cc into WallpaperManager, but it might be quite a lot | |
| 45 // of work. | |
| 46 } | |
| 47 | |
| 48 } // namespace arc | |
| OLD | NEW |