Commit fd6ef652 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Add "Save to Drive" deprecation warning under destination select

Add a deprecation warning message for the "Save to Drive" destination
under the destination select.

Screenshot of change: https://imgur.com/ix1GjIB

Bug: 1112581
Change-Id: Icecc4e90e97f0e4faae0ceca32e19fe10a5de51f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353555
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799230}
parent 46358146
...@@ -420,7 +420,7 @@ ...@@ -420,7 +420,7 @@
</message> </message>
<if expr="not chromeos"> <if expr="not chromeos">
<message name="IDS_GOOGLE_DRIVE_OPTION_NOT_SUPPORTED_WARNING" desc="Warning shown to the user to inform them that saving to Google Drive will no longer be supported."> <message name="IDS_GOOGLE_DRIVE_OPTION_NOT_SUPPORTED_WARNING" desc="Warning shown to the user to inform them that saving to Google Drive will no longer be supported.">
This option won't be supported after December. <ph name="BEGIN_LINK_LEARN_MORE">&lt;a is="action-link" href="" target="_blank"&gt;</ph>Learn more<ph name="END_LINK_LEARN_MORE">&lt;/a&gt;</ph> This option won't be supported after December. <ph name="BEGIN_LINK_LEARN_MORE">&lt;a href="$1<ex>https://google.com/</ex>" target="_blank"&gt;</ph>Learn more<ph name="END_LINK_LEARN_MORE">&lt;/a&gt;</ph>
</message> </message>
<message name="IDS_GOOGLE_DRIVE_OPTION_NOT_SUPPORTED_WARNING_ENTERPRISE" desc="Warning shown to users managed by enterprise policy to inform them that saving to Google Drive will no longer be supported."> <message name="IDS_GOOGLE_DRIVE_OPTION_NOT_SUPPORTED_WARNING_ENTERPRISE" desc="Warning shown to users managed by enterprise policy to inform them that saving to Google Drive will no longer be supported.">
This option won't be supported after December. Contact your admin. This option won't be supported after December. Contact your admin.
......
063af411afd178ac9c505958807cc8429624ed70 d98b8cce548526f85193cee9910d8f77365ce813
\ No newline at end of file \ No newline at end of file
<style include="print-preview-shared throbber md-select destination-select cr-hidden-style"> <style include="print-preview-shared throbber md-select destination-select
cr-hidden-style">
</style> </style>
<print-preview-settings-section> <print-preview-settings-section>
<span slot="title">$i18n{destinationLabel}</span> <span slot="title">$i18n{destinationLabel}</span>
...@@ -37,6 +38,6 @@ ...@@ -37,6 +38,6 @@
hidden$="[[!statusText_]]"> hidden$="[[!statusText_]]">
<div slot="title"></div> <div slot="title"></div>
<div slot="controls"> <div slot="controls">
<div class="destination-status">[[statusText_]]</div> <div class="destination-status"></div>
</div> </div>
</print-preview-settings-section> </print-preview-settings-section>
...@@ -21,6 +21,7 @@ import './throbber_css.js'; ...@@ -21,6 +21,7 @@ import './throbber_css.js';
import '../strings.m.js'; import '../strings.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {Base, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {Base, html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {Destination, DestinationOrigin, PDF_DESTINATION_KEY, RecentDestination} from '../data/destination.js'; import {Destination, DestinationOrigin, PDF_DESTINATION_KEY, RecentDestination} from '../data/destination.js';
...@@ -66,6 +67,7 @@ Polymer({ ...@@ -66,6 +67,7 @@ Polymer({
statusText_: { statusText_: {
type: String, type: String,
computed: 'computeStatusText_(destination)', computed: 'computeStatusText_(destination)',
observer: 'onStatusTextSet_'
}, },
}, },
...@@ -103,6 +105,9 @@ Polymer({ ...@@ -103,6 +105,9 @@ Polymer({
// Check for the Docs or Save as PDF ids first. // Check for the Docs or Save as PDF ids first.
const keyParams = this.selectedValue.split('/'); const keyParams = this.selectedValue.split('/');
if (keyParams[0] === Destination.GooglePromotedId.DOCS) { if (keyParams[0] === Destination.GooglePromotedId.DOCS) {
if (!loadTimeData.getBoolean('cloudPrintDeprecationWarningsSuppressed')) {
return 'print-preview:save-to-drive-not-supported';
}
return 'print-preview:save-to-drive'; return 'print-preview:save-to-drive';
} }
if (keyParams[0] === Destination.GooglePromotedId.SAVE_AS_PDF) { if (keyParams[0] === Destination.GooglePromotedId.SAVE_AS_PDF) {
...@@ -158,9 +163,20 @@ Polymer({ ...@@ -158,9 +163,20 @@ Polymer({
return ''; return '';
} }
return this.destination.shouldShowInvalidCertificateError ? if (this.destination.shouldShowInvalidCertificateError) {
this.i18n('noLongerSupportedFragment') : return this.i18n('noLongerSupportedFragment');
this.destination.connectionStatusText; }
if (this.destination.shouldShowSaveToDriveWarning) {
return this.i18nAdvanced('saveToDriveNotSupportedWarning');
}
return this.destination.connectionStatusText;
},
/** @private */
onStatusTextSet_() {
this.$$('.destination-status').innerHTML = this.statusText_;
}, },
/** /**
......
...@@ -32,10 +32,7 @@ ...@@ -32,10 +32,7 @@
.destination-status { .destination-status {
color: var(--cr-secondary-text-color); color: var(--cr-secondary-text-color);
font-size: calc(12/13 * 1em); font-size: calc(12/13 * 1em);
overflow: hidden; padding: 4px 0;
padding-top: 4px;
text-overflow: ellipsis;
white-space: nowrap;
} }
</style> </style>
</template> </template>
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "chrome/grit/print_preview_resources.h" #include "chrome/grit/print_preview_resources.h"
#include "chrome/grit/print_preview_resources_map.h" #include "chrome/grit/print_preview_resources_map.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "components/cloud_devices/common/cloud_devices_urls.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/printing/common/print_messages.h" #include "components/printing/common/print_messages.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
...@@ -350,6 +351,18 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) { ...@@ -350,6 +351,18 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
chrome::kCloudPrintCertificateErrorLearnMoreURL); chrome::kCloudPrintCertificateErrorLearnMoreURL);
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
if (webui::IsEnterpriseManaged()) {
source->AddLocalizedString(
"saveToDriveNotSupportedWarning",
IDS_GOOGLE_DRIVE_OPTION_NOT_SUPPORTED_WARNING_ENTERPRISE);
} else {
source->AddString(
"saveToDriveNotSupportedWarning",
l10n_util::GetStringFUTF16(
IDS_GOOGLE_DRIVE_OPTION_NOT_SUPPORTED_WARNING,
base::ASCIIToUTF16(cloud_devices::kCloudPrintDeprecationHelpURL)));
}
const base::string16 shortcut_text(base::UTF8ToUTF16(kBasicPrintShortcut)); const base::string16 shortcut_text(base::UTF8ToUTF16(kBasicPrintShortcut));
source->AddString("systemDialogOption", source->AddString("systemDialogOption",
l10n_util::GetStringFUTF16( l10n_util::GetStringFUTF16(
......
...@@ -102,18 +102,16 @@ suite(destination_select_test.suiteName, function() { ...@@ -102,18 +102,16 @@ suite(destination_select_test.suiteName, function() {
return selectOption(destinationSelect, driveKey) return selectOption(destinationSelect, driveKey)
.then(() => { .then(() => {
const saveToDriveIcon = cloudPrintDeprecationWarningsSuppressed ?
'save-to-drive' :
'save-to-drive-not-supported';
// Icon updates early based on the ID. // Icon updates early based on the ID.
// TODO(dhoss): This icon should be 'save-to-drive-not-supported' compareIcon(selectEl, saveToDriveIcon);
// after all cloud print deprecation warnings are implemented.
compareIcon(selectEl, 'save-to-drive');
// Update the destination. // Update the destination.
destinationSelect.destination = getGoogleDriveDestination(account); destinationSelect.destination = getGoogleDriveDestination(account);
const saveToDriveIcon = cloudPrintDeprecationWarningsSuppressed ?
'save-to-drive' :
'save-to-drive-not-supported';
// Still Save to Drive icon. // Still Save to Drive icon.
compareIcon(selectEl, saveToDriveIcon); compareIcon(selectEl, saveToDriveIcon);
...@@ -155,6 +153,7 @@ suite(destination_select_test.suiteName, function() { ...@@ -155,6 +153,7 @@ suite(destination_select_test.suiteName, function() {
function testUpdateStatus(cloudPrintDeprecationWarningsSuppressed) { function testUpdateStatus(cloudPrintDeprecationWarningsSuppressed) {
loadTimeData.overrideValues({ loadTimeData.overrideValues({
offline: 'offline', offline: 'offline',
saveToDriveNotSupportedWarning: 'saveToDriveNotSupportedWarning',
}); });
assertFalse(destinationSelect.$$('.throbber-container').hidden); assertFalse(destinationSelect.$$('.throbber-container').hidden);
...@@ -171,8 +170,12 @@ suite(destination_select_test.suiteName, function() { ...@@ -171,8 +170,12 @@ suite(destination_select_test.suiteName, function() {
destinationSelect.driveDestinationKey = driveKey; destinationSelect.driveDestinationKey = driveKey;
destinationSelect.destination = getGoogleDriveDestination(account); destinationSelect.destination = getGoogleDriveDestination(account);
destinationSelect.updateDestination(); destinationSelect.updateDestination();
assertTrue(additionalInfoEl.hidden); const saveToDriveStatus = cloudPrintDeprecationWarningsSuppressed ?
assertEquals('', statusEl.innerHTML); '' :
'saveToDriveNotSupportedWarning';
assertEquals(
cloudPrintDeprecationWarningsSuppressed, additionalInfoEl.hidden);
assertEquals(saveToDriveStatus, statusEl.innerHTML);
destinationSelect.destination = recentDestinationList[0]; destinationSelect.destination = recentDestinationList[0];
destinationSelect.updateDestination(); destinationSelect.updateDestination();
......
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