Commit 0863af79 authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

cros: Clean up old wallpaper picker code (Part IV)

Remove the deprecated v2 css class. Also remove unused assets.

Bug: 812085
Change-Id: I2eef2dd7f1e6386e626903cc294b09d50df765c3
Reviewed-on: https://chromium-review.googlesource.com/c/1490738Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635910}
parent 89eb7618
......@@ -310,38 +310,39 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
var wpDocument = wallpaperPickerWindow.contentWindow.document;
var messageContainer = wpDocument.querySelector('#message-container');
if (appName) {
chrome.wallpaperPrivate.getStrings(function(strings) {
chrome.wallpaperPrivate.getStrings(strings => {
if (appName) {
var message =
strings.currentWallpaperSetByMessage.replace(/\$1/g, appName);
messageContainer.textContent = message;
messageContainer.style.visibility = 'visible';
wpDocument.querySelector('#wallpaper-grid').classList.add('small');
wpDocument.querySelector('#checkbox').classList.remove('checked');
wpDocument.querySelector('#categories-list').disabled = false;
wpDocument.querySelector('#wallpaper-grid').disabled = false;
});
} else {
messageContainer.style.visibility = 'hidden';
wpDocument.querySelector('#wallpaper-grid').classList.remove('small');
Constants.WallpaperSyncStorage.get(
Constants.AccessSyncSurpriseMeEnabledKey, function(item) {
// TODO(crbug.com/810169): Try to combine this part with
// |WallpaperManager.onSurpriseMeStateChanged_|. The logic is
// duplicate.
var enable = item[Constants.AccessSyncSurpriseMeEnabledKey];
if (enable) {
wpDocument.querySelector('#checkbox')
.classList.add('checked');
} else {
wpDocument.querySelector('#checkbox')
.classList.remove('checked');
if (wpDocument.querySelector('.check'))
wpDocument.querySelector('.check').style.visibility =
'visible';
}
});
}
} else {
if (messageContainer.textContent !=
strings.setSuccessfullyMessage) {
messageContainer.style.visibility = 'hidden';
}
Constants.WallpaperSyncStorage.get(
Constants.AccessSyncSurpriseMeEnabledKey, function(item) {
// TODO(crbug.com/810169): Try to combine this part with
// |WallpaperManager.onSurpriseMeStateChanged_|. The logic is
// duplicate.
var enable = item[Constants.AccessSyncSurpriseMeEnabledKey];
if (enable) {
wpDocument.querySelector('#checkbox')
.classList.add('checked');
} else {
wpDocument.querySelector('#checkbox')
.classList.remove('checked');
if (wpDocument.querySelector('.check'))
wpDocument.querySelector('.check').style.visibility =
'visible';
}
});
}
});
};
if (changes[Constants.AccessLocalWallpaperInfoKey]) {
......
......@@ -24,8 +24,6 @@ function WallpaperManager(dialogDom) {
this.currentWallpaper_ = null;
this.wallpaperRequest_ = null;
this.preDownloadDomInit_();
// TODO(wzang): Remove this class.
this.document_.body.classList.add('v2');
// The wallpaper picker has two steps of fetching the online images: it first
// fetches a list of collection names (ie. categories such as Art,
......@@ -383,10 +381,8 @@ WallpaperManager.prototype.postDownloadDomInit_ = function() {
$('message-container').textContent =
loadTimeData.getStringF('currentWallpaperSetByMessage', appName);
$('message-container').style.visibility = 'visible';
$('wallpaper-grid').classList.add('small');
} else {
$('message-container').style.visibility = 'hidden';
$('wallpaper-grid').classList.remove('small');
}
});
......@@ -657,9 +653,7 @@ WallpaperManager.prototype.onWallpaperChanged_ = function(
this.wallpaperGrid_.activeItem = activeItem;
this.currentWallpaper_ = currentWallpaperURL;
this.decorateCurrentWallpaperInfoBar_();
$('wallpaper-grid').classList.remove('small');
this.wallpaperGrid_.checkmark.focus();
this.wallpaperGrid_.checkmark.focus();
// Disables daily refresh if user selects a non-daily wallpaper.
if (activeItem && activeItem.source !== Constants.WallpaperSourceEnum.Daily)
......@@ -1254,10 +1248,6 @@ WallpaperManager.prototype.onCategoriesChange_ = function() {
var selectedIndex = categoriesList.selectionModel.selectedIndex;
if (selectedIndex == -1)
return;
var selectedListItem = categoriesList.getListItemByIndex(selectedIndex);
var bar = $('bar');
bar.style.left = selectedListItem.offsetLeft + 'px';
bar.style.width = selectedListItem.offsetWidth + 'px';
// Cancel any ongoing wallpaper request if user clicks on another category.
if (this.wallpaperRequest_) {
this.wallpaperRequest_.abort();
......@@ -1265,7 +1255,7 @@ WallpaperManager.prototype.onCategoriesChange_ = function() {
}
// Always start with the top when showing a new category.
this.wallpaperGrid_.scrollTop = 0;
var selectedListItem = categoriesList.getListItemByIndex(selectedIndex);
if (selectedListItem.custom) {
var wallpapersDataModel = new cr.ui.ArrayDataModel([]);
if (loadTimeData.getBoolean('isOEMDefaultWallpaper')) {
......
......@@ -91,10 +91,8 @@ found in the LICENSE file.
<div class="dialog-topbar">
<div id="navstrip">
<list id="categories-list"></list>
<div id="bar"></div>
</div>
<div class="spacer"></div>
<div id="window-close-button" class="close"></div>
</div>
<div class="dialog-main">
<div id="category-container">
......
......@@ -111,10 +111,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient {
// Shows the wallpaper of the first user in |UserManager::GetUsers|, or a
// default signin wallpaper if there's no user. This ensures the wallpaper is
// shown right after boot, regardless of when the login screen is available.
//
// TODO(wzang|784495): Consider deprecating this method after views-based
// login is enabled. It should be fast enough to request the first wallpaper
// so that there's no visible delay.
void ShowWallpaperOnLoginScreen();
// ash::mojom::WallpaperControllerClient:
......
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