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) { ...@@ -310,38 +310,39 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
var wpDocument = wallpaperPickerWindow.contentWindow.document; var wpDocument = wallpaperPickerWindow.contentWindow.document;
var messageContainer = wpDocument.querySelector('#message-container'); var messageContainer = wpDocument.querySelector('#message-container');
if (appName) { chrome.wallpaperPrivate.getStrings(strings => {
chrome.wallpaperPrivate.getStrings(function(strings) { if (appName) {
var message = var message =
strings.currentWallpaperSetByMessage.replace(/\$1/g, appName); strings.currentWallpaperSetByMessage.replace(/\$1/g, appName);
messageContainer.textContent = message; messageContainer.textContent = message;
messageContainer.style.visibility = 'visible'; messageContainer.style.visibility = 'visible';
wpDocument.querySelector('#wallpaper-grid').classList.add('small');
wpDocument.querySelector('#checkbox').classList.remove('checked'); wpDocument.querySelector('#checkbox').classList.remove('checked');
wpDocument.querySelector('#categories-list').disabled = false; wpDocument.querySelector('#categories-list').disabled = false;
wpDocument.querySelector('#wallpaper-grid').disabled = false; wpDocument.querySelector('#wallpaper-grid').disabled = false;
}); } else {
} else { if (messageContainer.textContent !=
messageContainer.style.visibility = 'hidden'; strings.setSuccessfullyMessage) {
wpDocument.querySelector('#wallpaper-grid').classList.remove('small'); messageContainer.style.visibility = 'hidden';
Constants.WallpaperSyncStorage.get( }
Constants.AccessSyncSurpriseMeEnabledKey, function(item) { Constants.WallpaperSyncStorage.get(
// TODO(crbug.com/810169): Try to combine this part with Constants.AccessSyncSurpriseMeEnabledKey, function(item) {
// |WallpaperManager.onSurpriseMeStateChanged_|. The logic is // TODO(crbug.com/810169): Try to combine this part with
// duplicate. // |WallpaperManager.onSurpriseMeStateChanged_|. The logic is
var enable = item[Constants.AccessSyncSurpriseMeEnabledKey]; // duplicate.
if (enable) { var enable = item[Constants.AccessSyncSurpriseMeEnabledKey];
wpDocument.querySelector('#checkbox') if (enable) {
.classList.add('checked'); wpDocument.querySelector('#checkbox')
} else { .classList.add('checked');
wpDocument.querySelector('#checkbox') } else {
.classList.remove('checked'); wpDocument.querySelector('#checkbox')
if (wpDocument.querySelector('.check')) .classList.remove('checked');
wpDocument.querySelector('.check').style.visibility = if (wpDocument.querySelector('.check'))
'visible'; wpDocument.querySelector('.check').style.visibility =
} 'visible';
}); }
} });
}
});
}; };
if (changes[Constants.AccessLocalWallpaperInfoKey]) { if (changes[Constants.AccessLocalWallpaperInfoKey]) {
......
...@@ -24,8 +24,6 @@ function WallpaperManager(dialogDom) { ...@@ -24,8 +24,6 @@ function WallpaperManager(dialogDom) {
this.currentWallpaper_ = null; this.currentWallpaper_ = null;
this.wallpaperRequest_ = null; this.wallpaperRequest_ = null;
this.preDownloadDomInit_(); 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 // The wallpaper picker has two steps of fetching the online images: it first
// fetches a list of collection names (ie. categories such as Art, // fetches a list of collection names (ie. categories such as Art,
...@@ -383,10 +381,8 @@ WallpaperManager.prototype.postDownloadDomInit_ = function() { ...@@ -383,10 +381,8 @@ WallpaperManager.prototype.postDownloadDomInit_ = function() {
$('message-container').textContent = $('message-container').textContent =
loadTimeData.getStringF('currentWallpaperSetByMessage', appName); loadTimeData.getStringF('currentWallpaperSetByMessage', appName);
$('message-container').style.visibility = 'visible'; $('message-container').style.visibility = 'visible';
$('wallpaper-grid').classList.add('small');
} else { } else {
$('message-container').style.visibility = 'hidden'; $('message-container').style.visibility = 'hidden';
$('wallpaper-grid').classList.remove('small');
} }
}); });
...@@ -657,9 +653,7 @@ WallpaperManager.prototype.onWallpaperChanged_ = function( ...@@ -657,9 +653,7 @@ WallpaperManager.prototype.onWallpaperChanged_ = function(
this.wallpaperGrid_.activeItem = activeItem; this.wallpaperGrid_.activeItem = activeItem;
this.currentWallpaper_ = currentWallpaperURL; this.currentWallpaper_ = currentWallpaperURL;
this.decorateCurrentWallpaperInfoBar_(); 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. // Disables daily refresh if user selects a non-daily wallpaper.
if (activeItem && activeItem.source !== Constants.WallpaperSourceEnum.Daily) if (activeItem && activeItem.source !== Constants.WallpaperSourceEnum.Daily)
...@@ -1254,10 +1248,6 @@ WallpaperManager.prototype.onCategoriesChange_ = function() { ...@@ -1254,10 +1248,6 @@ WallpaperManager.prototype.onCategoriesChange_ = function() {
var selectedIndex = categoriesList.selectionModel.selectedIndex; var selectedIndex = categoriesList.selectionModel.selectedIndex;
if (selectedIndex == -1) if (selectedIndex == -1)
return; 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. // Cancel any ongoing wallpaper request if user clicks on another category.
if (this.wallpaperRequest_) { if (this.wallpaperRequest_) {
this.wallpaperRequest_.abort(); this.wallpaperRequest_.abort();
...@@ -1265,7 +1255,7 @@ WallpaperManager.prototype.onCategoriesChange_ = function() { ...@@ -1265,7 +1255,7 @@ WallpaperManager.prototype.onCategoriesChange_ = function() {
} }
// Always start with the top when showing a new category. // Always start with the top when showing a new category.
this.wallpaperGrid_.scrollTop = 0; this.wallpaperGrid_.scrollTop = 0;
var selectedListItem = categoriesList.getListItemByIndex(selectedIndex);
if (selectedListItem.custom) { if (selectedListItem.custom) {
var wallpapersDataModel = new cr.ui.ArrayDataModel([]); var wallpapersDataModel = new cr.ui.ArrayDataModel([]);
if (loadTimeData.getBoolean('isOEMDefaultWallpaper')) { if (loadTimeData.getBoolean('isOEMDefaultWallpaper')) {
......
...@@ -91,10 +91,8 @@ found in the LICENSE file. ...@@ -91,10 +91,8 @@ found in the LICENSE file.
<div class="dialog-topbar"> <div class="dialog-topbar">
<div id="navstrip"> <div id="navstrip">
<list id="categories-list"></list> <list id="categories-list"></list>
<div id="bar"></div>
</div> </div>
<div class="spacer"></div> <div class="spacer"></div>
<div id="window-close-button" class="close"></div>
</div> </div>
<div class="dialog-main"> <div class="dialog-main">
<div id="category-container"> <div id="category-container">
......
...@@ -111,10 +111,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient { ...@@ -111,10 +111,6 @@ class WallpaperControllerClient : public ash::mojom::WallpaperControllerClient {
// Shows the wallpaper of the first user in |UserManager::GetUsers|, or a // 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 // 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. // 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(); void ShowWallpaperOnLoginScreen();
// ash::mojom::WallpaperControllerClient: // 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