Commit fd49446d authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

cros: Add OEM wallpaper back to wallpaper picker

The added code is mostly the ones deleted in https://chromium-review.googlesource.com/c/chromium/src/+/1297308
as part of "old-wallpaper-picker only" code path.

Bug: 899872
Change-Id: I7dbad13c00d50841091b9f51656428025efae096
Reviewed-on: https://chromium-review.googlesource.com/c/1308936Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604086}
parent 718661be
...@@ -80,6 +80,9 @@ ...@@ -80,6 +80,9 @@
<message name="IDS_CURRENT_WALLPAPER_SET_BY_MESSAGE" desc="The string displayed to user if the current wallpaper is set by a third party wallpaper app/extension."> <message name="IDS_CURRENT_WALLPAPER_SET_BY_MESSAGE" desc="The string displayed to user if the current wallpaper is set by a third party wallpaper app/extension.">
The current wallpaper is set by '<ph name="APP_NAME">$1</ph>'. You may need to uninstall '<ph name="APP_NAME">$1</ph>' before selecting a different wallpaper. The current wallpaper is set by '<ph name="APP_NAME">$1</ph>'. You may need to uninstall '<ph name="APP_NAME">$1</ph>' before selecting a different wallpaper.
</message> </message>
<message name="IDS_DEFAULT_WALLPAPER_ACCESSIBLE_LABEL" desc="Accessibility text read by chromevox when the default wallpaper is focused.">
Default wallpaper
</message>
<!-- Zip Archiver --> <!-- Zip Archiver -->
<message desc="The product name for Zip Archiver." name="IDS_ZIP_ARCHIVER_NAME"> <message desc="The product name for Zip Archiver." name="IDS_ZIP_ARCHIVER_NAME">
......
...@@ -229,6 +229,7 @@ ExtensionFunction::ResponseAction WallpaperPrivateGetStringsFunction::Run() { ...@@ -229,6 +229,7 @@ ExtensionFunction::ResponseAction WallpaperPrivateGetStringsFunction::Run() {
IDS_WALLPAPER_MANAGER_CONFIRM_PREVIEW_WALLPAPER_LABEL); IDS_WALLPAPER_MANAGER_CONFIRM_PREVIEW_WALLPAPER_LABEL);
SET_STRING("setSuccessfullyMessage", SET_STRING("setSuccessfullyMessage",
IDS_WALLPAPER_MANAGER_SET_SUCCESSFULLY_MESSAGE); IDS_WALLPAPER_MANAGER_SET_SUCCESSFULLY_MESSAGE);
SET_STRING("defaultWallpaperLabel", IDS_DEFAULT_WALLPAPER_ACCESSIBLE_LABEL);
#undef SET_STRING #undef SET_STRING
const std::string& app_locale = g_browser_process->GetApplicationLocale(); const std::string& app_locale = g_browser_process->GetApplicationLocale();
......
...@@ -1534,10 +1534,19 @@ WallpaperManager.prototype.onCategoriesChange_ = function() { ...@@ -1534,10 +1534,19 @@ WallpaperManager.prototype.onCategoriesChange_ = function() {
this.wallpaperRequest_ = null; this.wallpaperRequest_ = null;
} }
if (selectedListItem.custom) { if (selectedListItem.custom) {
chrome.wallpaperPrivate.getLocalImagePaths(localImagePaths => {
// Show a 'no images' message to user if there's no local image.
this.updateNoImagesVisibility_(localImagePaths.length == 0);
var wallpapersDataModel = new cr.ui.ArrayDataModel([]); var wallpapersDataModel = new cr.ui.ArrayDataModel([]);
if (loadTimeData.getBoolean('isOEMDefaultWallpaper')) {
var defaultWallpaperInfo = {
wallpaperId: null,
baseURL: 'OemDefaultWallpaper',
layout: Constants.WallpaperThumbnailDefaultLayout,
source: Constants.WallpaperSourceEnum.OEM,
ariaLabel: loadTimeData.getString('defaultWallpaperLabel'),
availableOffline: true
};
wallpapersDataModel.push(defaultWallpaperInfo);
}
chrome.wallpaperPrivate.getLocalImagePaths(localImagePaths => {
for (var imagePath of localImagePaths) { for (var imagePath of localImagePaths) {
var wallpaperInfo = { var wallpaperInfo = {
// The absolute file path, used for retrieving the image data if user // The absolute file path, used for retrieving the image data if user
...@@ -1559,7 +1568,8 @@ WallpaperManager.prototype.onCategoriesChange_ = function() { ...@@ -1559,7 +1568,8 @@ WallpaperManager.prototype.onCategoriesChange_ = function() {
}; };
wallpapersDataModel.push(wallpaperInfo); wallpapersDataModel.push(wallpaperInfo);
} }
// Display the images. // Show a "no images" message if there's no image.
this.updateNoImagesVisibility_(wallpapersDataModel.length == 0);
this.wallpaperGrid_.dataModel = wallpapersDataModel; this.wallpaperGrid_.dataModel = wallpapersDataModel;
}); });
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment