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

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

Issue 2345153002: cheets: add wallpaper observer to arc_wallpaper_service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cheets: switch arc wallpaper layout to CENTER_CROPPED. Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698