Commit 66e073dd authored by Kyle Milka's avatar Kyle Milka Committed by Commit Bot

[NTP] Remove Google Photos option for custom backgrounds

Completely remove the Google Photos option for background
customization. If it's just hidden it will still show up
after the network state changes. It would also be possible
inspect the page and trigger the dialog.

Bug: 869230
Change-Id: I312164ae0648c108709c2809382ff1ca610b8c5f
Reviewed-on: https://chromium-review.googlesource.com/1156882
Commit-Queue: Kyle Milka <kmilka@chromium.org>
Reviewed-by: default avatarKristi Park <kristipark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579524}
parent fb356de7
...@@ -33,8 +33,6 @@ customBackgrounds.IDS = { ...@@ -33,8 +33,6 @@ customBackgrounds.IDS = {
ATTRIBUTIONS: 'custom-bg-attr', ATTRIBUTIONS: 'custom-bg-attr',
BACK: 'bg-sel-back', BACK: 'bg-sel-back',
CANCEL: 'bg-sel-footer-cancel', CANCEL: 'bg-sel-footer-cancel',
CONNECT_GOOGLE_PHOTOS: 'edit-bg-google-photos',
CONNECT_GOOGLE_PHOTOS_TEXT: 'edit-bg-google-photos-text',
CUSTOM_LINKS_RESTORE_DEFAULT: 'custom-links-restore-default', CUSTOM_LINKS_RESTORE_DEFAULT: 'custom-links-restore-default',
CUSTOM_LINKS_RESTORE_DEFAULT_TEXT: 'custom-links-restore-default-text', CUSTOM_LINKS_RESTORE_DEFAULT_TEXT: 'custom-links-restore-default-text',
DEFAULT_WALLPAPERS: 'edit-bg-default-wallpapers', DEFAULT_WALLPAPERS: 'edit-bg-default-wallpapers',
...@@ -105,11 +103,10 @@ customBackgrounds.SOURCES = { ...@@ -105,11 +103,10 @@ customBackgrounds.SOURCES = {
* @const * @const
*/ */
customBackgrounds.MENU_ENTRIES = { customBackgrounds.MENU_ENTRIES = {
GOOGLE_PHOTOS: 0, CHROME_BACKGROUNDS: 0,
CHROME_BACKGROUNDS: 1, UPLOAD_IMAGE: 1,
UPLOAD_IMAGE: 2, RESTORE_DEFAULT: 2,
RESTORE_DEFAULT: 3, CUSTOM_LINKS_RESTORE_DEFAULT: 3,
RESTORE_DEFAULT_CUSTOM_LINKS: 4,
}; };
customBackgrounds.CUSTOM_BACKGROUND_OVERLAY = customBackgrounds.CUSTOM_BACKGROUND_OVERLAY =
...@@ -640,11 +637,10 @@ customBackgrounds.getNextOption = function(current_index, deltaY) { ...@@ -640,11 +637,10 @@ customBackgrounds.getNextOption = function(current_index, deltaY) {
// Create array corresponding to the menu. Important that this is in the same // Create array corresponding to the menu. Important that this is in the same
// order as the MENU_ENTRIES enum, so we can index into it. // order as the MENU_ENTRIES enum, so we can index into it.
var entries = []; var entries = [];
entries.push($(customBackgrounds.IDS.CONNECT_GOOGLE_PHOTOS));
entries.push($(customBackgrounds.IDS.DEFAULT_WALLPAPERS)); entries.push($(customBackgrounds.IDS.DEFAULT_WALLPAPERS));
entries.push($(customBackgrounds.IDS.UPLOAD_IMAGE)); entries.push($(customBackgrounds.IDS.UPLOAD_IMAGE));
entries.push($(customBackgrounds.IDS.RESTORE_DEFAULT)); entries.push($(customBackgrounds.IDS.RESTORE_DEFAULT));
entries.push($(customBackgrounds.IDS.RESTORE_DEFAULT_CUSTOM_LINKS)); entries.push($(customBackgrounds.IDS.CUSTOM_LINKS_RESTORE_DEFAULT));
var idx = current_index; var idx = current_index;
do { do {
...@@ -663,7 +659,6 @@ customBackgrounds.getNextOption = function(current_index, deltaY) { ...@@ -663,7 +659,6 @@ customBackgrounds.getNextOption = function(current_index, deltaY) {
* @param {bool} online The current state of the network * @param {bool} online The current state of the network
*/ */
customBackgrounds.networkStateChanged = function(online) { customBackgrounds.networkStateChanged = function(online) {
$(customBackgrounds.IDS.CONNECT_GOOGLE_PHOTOS).hidden = !online;
$(customBackgrounds.IDS.DEFAULT_WALLPAPERS).hidden = !online; $(customBackgrounds.IDS.DEFAULT_WALLPAPERS).hidden = !online;
}; };
...@@ -770,12 +765,12 @@ customBackgrounds.initCustomLinksItems = function() { ...@@ -770,12 +765,12 @@ customBackgrounds.initCustomLinksItems = function() {
else if (event.keyCode === customBackgrounds.KEYCODES.UP) { else if (event.keyCode === customBackgrounds.KEYCODES.UP) {
customBackgrounds customBackgrounds
.getNextOption( .getNextOption(
customBackgrounds.MENU_ENTRIES.RESTORE_DEFAULT_CUSTOM_LINKS, -1) customBackgrounds.MENU_ENTRIES.CUSTOM_LINKS_RESTORE_DEFAULT, -1)
.focus(); .focus();
} else if (event.keyCode === customBackgrounds.KEYCODES.DOWN) { } else if (event.keyCode === customBackgrounds.KEYCODES.DOWN) {
customBackgrounds customBackgrounds
.getNextOption( .getNextOption(
customBackgrounds.MENU_ENTRIES.RESTORE_DEFAULT_CUSTOM_LINKS, 1) customBackgrounds.MENU_ENTRIES.CUSTOM_LINKS_RESTORE_DEFAULT, 1)
.focus(); .focus();
} }
}; };
...@@ -789,8 +784,6 @@ customBackgrounds.initCustomBackgrounds = function() { ...@@ -789,8 +784,6 @@ customBackgrounds.initCustomBackgrounds = function() {
var editDialog = $(customBackgrounds.IDS.EDIT_BG_DIALOG); var editDialog = $(customBackgrounds.IDS.EDIT_BG_DIALOG);
var menu = $(customBackgrounds.IDS.MENU); var menu = $(customBackgrounds.IDS.MENU);
$(customBackgrounds.IDS.CONNECT_GOOGLE_PHOTOS_TEXT).textContent =
configData.translatedStrings.connectGooglePhotos;
$(customBackgrounds.IDS.DEFAULT_WALLPAPERS_TEXT).textContent = $(customBackgrounds.IDS.DEFAULT_WALLPAPERS_TEXT).textContent =
configData.translatedStrings.defaultWallpapers; configData.translatedStrings.defaultWallpapers;
$(customBackgrounds.IDS.UPLOAD_IMAGE_TEXT).textContent = $(customBackgrounds.IDS.UPLOAD_IMAGE_TEXT).textContent =
...@@ -909,52 +902,6 @@ customBackgrounds.initCustomBackgrounds = function() { ...@@ -909,52 +902,6 @@ customBackgrounds.initCustomBackgrounds = function() {
} }
}; };
// Interactions with the Google Photos option.
var googlePhotosInteraction = function(event) {
customBackgrounds.loadGooglePhotosAlbums();
$('ntp-album-loader').onload = function() {
if (typeof albums != 'undefined' && !albums_errors.auth_error &&
!albums_errors.net_error && !albums_errors.service_error) {
editDialog.close();
customBackgrounds.showCollectionSelectionDialog(
customBackgrounds.SOURCES.GOOGLE_PHOTOS);
} else {
// If an auth error occurs leave the dialog open and redirect the
// user to sign-in again. Then they can return to the same place in
// the customization flow.
if (!albums_errors.auth_error) {
editDialog.close();
}
customBackgrounds.handleError(albums_errors);
}
};
};
$(customBackgrounds.IDS.CONNECT_GOOGLE_PHOTOS).onclick = function(event) {
$(customBackgrounds.IDS.MENU)
.classList.add(customBackgrounds.CLASSES.MOUSE_NAV);
googlePhotosInteraction(event);
};
$(customBackgrounds.IDS.CONNECT_GOOGLE_PHOTOS).onkeyup = function(event) {
if (event.keyCode === customBackgrounds.KEYCODES.ENTER) {
$(customBackgrounds.IDS.MENU)
.classList.remove(customBackgrounds.CLASSES.MOUSE_NAV);
googlePhotosInteraction(event);
}
// Handle arrow key navigation.
if (event.keyCode === customBackgrounds.KEYCODES.UP) {
customBackgrounds
.getNextOption(customBackgrounds.MENU_ENTRIES.GOOGLE_PHOTOS, -1)
.focus();
}
if (event.keyCode === customBackgrounds.KEYCODES.DOWN) {
customBackgrounds
.getNextOption(customBackgrounds.MENU_ENTRIES.GOOGLE_PHOTOS, 1)
.focus();
}
};
// Escape and Backspace handling for the background picker dialog. // Escape and Backspace handling for the background picker dialog.
menu.onkeydown = function(event) { menu.onkeydown = function(event) {
if (event.keyCode === customBackgrounds.KEYCODES.ESC || if (event.keyCode === customBackgrounds.KEYCODES.ESC ||
......
...@@ -88,10 +88,6 @@ ...@@ -88,10 +88,6 @@
<dialog div id="edit-bg-dialog"> <dialog div id="edit-bg-dialog">
<div id="edit-bg-title"></div> <div id="edit-bg-title"></div>
<div id="edit-bg-google-photos" class="bg-option" tabindex="0" hidden>
<div class="bg-option-img"></div>
<div id="edit-bg-google-photos-text" class="bg-option-text"></div>
</div>
<div id="edit-bg-default-wallpapers" class="bg-option" tabindex="0"> <div id="edit-bg-default-wallpapers" class="bg-option" tabindex="0">
<div class="bg-option-img"></div> <div class="bg-option-img"></div>
<div id="edit-bg-default-wallpapers-text" class="bg-option-text"> <div id="edit-bg-default-wallpapers-text" class="bg-option-text">
......
...@@ -73,10 +73,6 @@ ...@@ -73,10 +73,6 @@
<dialog div id="edit-bg-dialog"> <dialog div id="edit-bg-dialog">
<div id="edit-bg-title"></div> <div id="edit-bg-title"></div>
<div id="edit-bg-google-photos" class="bg-option" tabindex="0" hidden>
<div class="bg-option-img"></div>
<div id="edit-bg-google-photos-text" class="bg-option-text"></div>
</div>
<div id="edit-bg-default-wallpapers" class="bg-option" tabindex="0"> <div id="edit-bg-default-wallpapers" class="bg-option" tabindex="0">
<div class="bg-option-img"></div> <div class="bg-option-img"></div>
<div id="edit-bg-default-wallpapers-text" class="bg-option-text"> <div id="edit-bg-default-wallpapers-text" class="bg-option-text">
......
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