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"; | |
|
Yusuke Sato
2016/06/15 16:45:01
nit: constexpr seems to be the new preferred way.
Shuhei Takahashi
2016/06/15 18:14:37
Done.
| |
| 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(crbug.com/618922): Allow specifying layout. | |
| 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(crbug.com/618922): Register the wallpaper to Chrome OS wallpaper | |
| 42 // picker. Currently the new wallpaper does not appear there. The best way to | |
| 43 // make this happen seems to refactor thumbnail generation logic in | |
| 44 // wallpaper_api.cc and wallpaper_private_api.cc into WallpaperManager, but | |
| 45 // it might be quite a lot of work. | |
|
xdai1
2016/06/15 16:30:14
That won't work. What you need to do is save the w
Shuhei Takahashi
2016/06/15 18:14:37
Thanks, updated the comment accordingly.
| |
| 46 } | |
| 47 | |
| 48 } // namespace arc | |
| OLD | NEW |