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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 const AccountId& account_id = | 47 const AccountId& account_id = |
48 UserManager::Get()->GetPrimaryUser()->GetAccountId(); | 48 UserManager::Get()->GetPrimaryUser()->GetAccountId(); |
49 wallpaper::WallpaperFilesId wallpaper_files_id = | 49 wallpaper::WallpaperFilesId wallpaper_files_id = |
50 wallpaper_manager->GetFilesId(account_id); | 50 wallpaper_manager->GetFilesId(account_id); |
51 const bool update_wallpaper = | 51 const bool update_wallpaper = |
52 account_id == UserManager::Get()->GetActiveUser()->GetAccountId(); | 52 account_id == UserManager::Get()->GetActiveUser()->GetAccountId(); |
53 // TODO(crbug.com/618922): Allow specifying layout. | 53 // TODO(crbug.com/618922): Allow specifying layout. |
54 wallpaper_manager->SetCustomWallpaper( | 54 wallpaper_manager->SetCustomWallpaper( |
55 account_id, wallpaper_files_id, kAndroidWallpaperFilename, | 55 account_id, wallpaper_files_id, kAndroidWallpaperFilename, |
56 wallpaper::WALLPAPER_LAYOUT_STRETCH, user_manager::User::CUSTOMIZED, | 56 wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED, |
57 image, update_wallpaper); | 57 user_manager::User::CUSTOMIZED, image, update_wallpaper); |
58 | 58 |
59 // TODO(crbug.com/618922): Register the wallpaper to Chrome OS wallpaper | 59 // TODO(crbug.com/618922): Register the wallpaper to Chrome OS wallpaper |
60 // picker. Currently the new wallpaper does not appear there. The best way to | 60 // picker. Currently the new wallpaper does not appear there. The best way to |
61 // make this happen seems to do the same things as wallpaper_api.cc and | 61 // make this happen seems to do the same things as wallpaper_api.cc and |
62 // wallpaper_private_api.cc. | 62 // wallpaper_private_api.cc. |
63 } | 63 } |
64 | 64 |
65 std::vector<uint8_t> EncodeImagePng(const gfx::ImageSkia image) { | 65 std::vector<uint8_t> EncodeImagePng(const gfx::ImageSkia image) { |
66 std::vector<uint8_t> result; | 66 std::vector<uint8_t> result; |
67 gfx::PNGCodec::FastEncodeBGRASkBitmap(*image.bitmap(), true, &result); | 67 gfx::PNGCodec::FastEncodeBGRASkBitmap(*image.bitmap(), true, &result); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
144 auto* wallpaper_instance = | 144 auto* wallpaper_instance = |
145 arc_bridge_service()->wallpaper()->GetInstanceForMethod( | 145 arc_bridge_service()->wallpaper()->GetInstanceForMethod( |
146 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); | 146 "OnWallpaperChanged", kMinOnWallpaperChangedVersion); |
147 if (!wallpaper_instance) | 147 if (!wallpaper_instance) |
148 return; | 148 return; |
149 wallpaper_instance->OnWallpaperChanged(); | 149 wallpaper_instance->OnWallpaperChanged(); |
150 } | 150 } |
151 | 151 |
152 } // namespace arc | 152 } // namespace arc |
OLD | NEW |