Commit bd6b5601 authored by Kyle Milka's avatar Kyle Milka Committed by Commit Bot

[NTP] Allow image to be set as custom bg in the RP

If an image tile is selected clikcing the done button
applies the image and closes the dialog.

screencast: http://go/scrcast/NTkxNjIzNDcwMDgxNjM4NHxmNzRjYzQ4YS1iZg

Bug: 937570
Change-Id: I15fd616f79908708d6c3cb6b3a55cafed80b59e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606187Reviewed-by: default avatarKristi Park <kristipark@chromium.org>
Commit-Queue: Kristi Park <kristipark@chromium.org>
Commit-Queue: Kyle Milka <kmilka@chromium.org>
Auto-Submit: Kyle Milka <kmilka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658767}
parent b76a327f
......@@ -334,7 +334,12 @@ customBackgrounds.closeCollectionDialog = function(menu) {
*/
customBackgrounds.setBackground = function(
url, attributionLine1, attributionLine2, attributionActionUrl) {
customBackgrounds.closeCollectionDialog($(customBackgrounds.IDS.MENU));
if (configData.richerPicker) {
$(customBackgrounds.IDS.CUSTOMIZATION_MENU).close();
customBackgrounds.resetImageMenu(false);
} else {
customBackgrounds.closeCollectionDialog($(customBackgrounds.IDS.MENU));
}
window.chrome.embeddedSearch.newTabPage.setBackgroundURLWithAttributions(
url, attributionLine1, attributionLine2, attributionActionUrl);
};
......@@ -1280,7 +1285,9 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
// Interactions with the done button on the background picker dialog.
const doneInteraction = function(event) {
if ($(customBackgrounds.IDS.DONE).disabled) {
const done = configData.richerPicker ? $(customBackgrounds.IDS.MENU_DONE) :
$(customBackgrounds.IDS.DONE);
if (done.disabled) {
return;
}
customBackgrounds.setBackground(
......@@ -1290,6 +1297,7 @@ customBackgrounds.initCustomBackgrounds = function(showErrorNotification) {
customBackgrounds.selectedTile.dataset.attributionActionUrl);
};
$(customBackgrounds.IDS.DONE).onclick = doneInteraction;
$(customBackgrounds.IDS.MENU_DONE).onclick = doneInteraction;
$(customBackgrounds.IDS.DONE).onkeyup = function(event) {
if (event.keyCode === customBackgrounds.KEYCODES.ENTER) {
doneInteraction(event);
......
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