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

Side by Side Diff: chrome/browser/chromeos/arc/arc_wallpaper_handler.cc

Issue 2061183002: arc: IPC method to set custom wallpaper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review ready. Created 4 years, 6 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 "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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698