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

Suppress Cloud Print deprecation warnings in chrome://settings with pref

Use an existing pref, "cloud_print.deprecation_warnings_suppressed", to
suppress deprecation warnings.

TBR=thestig@chromium.org

Bug: 1112581
Change-Id: I76af61dc4b1faa387e179121dafe48a361c2ad7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363448
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799986}
parent 83d41f29
......@@ -11,7 +11,7 @@
padding: 0 var(--warning-extra-spacing);
}
</style>
<div id="cloud-print-warning">
<div id="cloud-print-warning" hidden$="[[hideCloudPrintWarning]]">
<div class="cr-padded-text">$i18nRaw{cloudPrintFullWarning}</div>
</div>
<settings-toggle-button
......
......@@ -22,6 +22,8 @@ Polymer({
_template: html`{__html_template__}`,
properties: {
hideCloudPrintWarning: Boolean,
prefs: {
type: Object,
notify: true,
......
......@@ -8,7 +8,7 @@
</if>
<cr-link-row class="hr" id="cloudPrinters"
label="$i18n{cloudPrintersTitle}"
sub-label="$i18n{cloudPrintWarning}"
sub-label="[[cloudPrintersSublabel_]]"
on-click="onTapCloudPrinters_"
role-description="$i18n{subpageArrowRoleDescription}">
</cr-link-row>
......@@ -17,7 +17,9 @@
<settings-subpage
associated-control="[[$$('#cloudPrinters')]]"
page-title="$i18n{cloudPrintersTitle}">
<settings-cloud-printers prefs="{{prefs}}">
<settings-cloud-printers
hide-cloud-print-warning="[[shouldHideCloudPrintWarning_]]"
prefs="{{prefs}}">
</settings-cloud-printers>
</settings-subpage>
</template>
......
......@@ -7,6 +7,8 @@ import '../settings_page/settings_animated_pages.m.js';
import '../settings_page/settings_subpage.m.js';
import '../settings_shared_css.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {routes} from '../route.js';
......@@ -21,6 +23,8 @@ Polymer({
_template: html`{__html_template__}`,
behaviors: [I18nBehavior],
properties: {
/** Preferences state. */
prefs: {
......@@ -32,6 +36,12 @@ Polymer({
type: String,
},
/** @private */
cloudPrintersSublabel_: {
type: String,
computed: 'computeCloudPrintersSublabel_(shouldHideCloudPrintWarning_)',
},
/** @private {!Map<string, string>} */
focusConfig_: {
type: Object,
......@@ -43,6 +53,21 @@ Polymer({
return map;
},
},
/** @private */
shouldHideCloudPrintWarning_: {
type: Boolean,
value: loadTimeData.getBoolean('cloudPrintDeprecationWarningsSuppressed'),
}
},
/**
* @return {string} The sublabel string for the Cloud Printers row.
* @private
*/
computeCloudPrintersSublabel_() {
return this.shouldHideCloudPrintWarning_ ? '' :
this.i18n('cloudPrintWarning');
},
// <if expr="not chromeos">
......
......@@ -144,6 +144,8 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
#if !defined(OS_ANDROID)
registry->RegisterBooleanPref(prefs::kCaretBrowsingEnabled, false);
registry->RegisterBooleanPref(prefs::kCloudPrintDeprecationWarningsSuppressed,
false);
registry->RegisterBooleanPref(prefs::kShowCaretBrowsingDialog, true);
#endif
......
......@@ -12,8 +12,6 @@ namespace printing {
// static
void PolicySettings::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kCloudPrintDeprecationWarningsSuppressed,
false);
registry->RegisterListPref(prefs::kPrinterTypeDenyList);
registry->RegisterBooleanPref(prefs::kPrintHeaderFooter, true);
registry->RegisterIntegerPref(prefs::kPrintingAllowedBackgroundGraphicsModes,
......
......@@ -36,6 +36,7 @@
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
......@@ -60,6 +61,7 @@
#include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
#include "components/password_manager/core/browser/manage_passwords_referrer.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/signin/public/base/signin_buildflags.h"
#include "components/strings/grit/components_chromium_strings.h"
......@@ -94,10 +96,8 @@
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
#include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_factory.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
#include "ui/chromeos/devicetype_utils.h"
#else // !defined(OS_CHROMEOS)
......@@ -1191,7 +1191,8 @@ void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
AddSyncPageStrings(html_source);
}
void AddPrintingStrings(content::WebUIDataSource* html_source) {
void AddPrintingStrings(content::WebUIDataSource* html_source,
Profile* profile) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"printingPageTitle", IDS_SETTINGS_PRINTING},
{"printingNotificationsLabel", IDS_SETTINGS_PRINTING_NOTIFICATIONS_LABEL},
......@@ -1207,12 +1208,17 @@ void AddPrintingStrings(content::WebUIDataSource* html_source) {
html_source->AddString("cloudPrintersUrl",
cloud_devices::GetCloudPrintPrintersURL().spec());
html_source->AddBoolean("cloudPrintDeprecationWarningsSuppressed",
profile->GetPrefs()->GetBoolean(
prefs::kCloudPrintDeprecationWarningsSuppressed));
const bool enterprise_managed = webui::IsEnterpriseManaged();
html_source->AddLocalizedString(
"cloudPrintWarning",
enterprise_managed
? IDS_SETTINGS_PRINTING_GOOGLE_CLOUD_PRINT_NOT_SUPPORTED_WARNING_ENTERPRISE
: IDS_SETTINGS_PRINTING_GOOGLE_CLOUD_PRINT_NOT_SUPPORTED_WARNING);
if (enterprise_managed) {
html_source->AddLocalizedString(
"cloudPrintFullWarning",
......@@ -2200,7 +2206,7 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source,
AddLanguagesStrings(html_source, profile);
AddOnStartupStrings(html_source);
AddPeopleStrings(html_source, profile);
AddPrintingStrings(html_source);
AddPrintingStrings(html_source, profile);
AddPrivacyStrings(html_source, profile);
AddResetStrings(html_source, profile);
AddSearchEnginesStrings(html_source);
......
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