Commit 00bab7fd authored by rbpotter's avatar rbpotter Committed by Commit Bot

Print Preview: Convert "learn more" link to a link from action-link

This link was added following an old pattern in the Print Preview code,
which was originally for opening a new tab just before closing Print
Preview for a feature that has now been deleted. A standard link works
for the current use case and is simpler.

Bug: None
Change-Id: I63955ded5a6d7c67edfaee5d7dbb6dec4e6b9dbe
Reviewed-on: https://chromium-review.googlesource.com/c/1274837Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599275}
parent ffaeaa3d
......@@ -278,7 +278,10 @@ cr.define('print_preview', function() {
chrome.send('managePrinters');
}
/** Forces browser to open a new tab with the given URL address. */
/**
* Forces browser to open a new tab with the given URL address.
* TODO (rbpotter): Delete this when the old Print Preview page is removed.
*/
forceOpenNewTab(url) {
chrome.send('forceOpenNewTab', [url]);
}
......
......@@ -317,9 +317,7 @@ js_library("destination_list") {
js_library("destination_list_item") {
deps = [
":highlight_utils",
"..:native_layer",
"../data:destination",
"//ui/webui/resources/js:load_time_data",
]
}
......
......@@ -128,6 +128,9 @@ Polymer({
* @private
*/
onDestinationSelected_: function(e) {
if (e.composedPath()[0].tagName === 'A')
return;
this.fire('destination-selected', e.target);
},
});
......
......@@ -3,10 +3,8 @@
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/load_time_data.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="../icons.html">
<link rel="import" href="../native_layer.html">
<link rel="import" href="../data/destination.html">
<link rel="import" href="highlight_utils.html">
<link rel="import" href="print_preview_shared_css.html">
......@@ -14,7 +12,7 @@
<dom-module id="print-preview-destination-list-item">
<template>
<style include="print-preview-shared action-link cr-hidden-style">
<style include="print-preview-shared cr-hidden-style">
:host {
align-items: center;
cursor: default;
......@@ -78,9 +76,9 @@
hidden$="[[!destination.isOfflineOrInvalid]]">
[[destination.connectionStatusText]]
</span>
<a is="action-link" class="learn-more-link"
hidden$="[[!destination.shouldShowInvalidCertificateError]]"
on-click="onLearnMoreLinkClick_">
<a href="$i18n{gcpCertificateErrorLearnMoreURL}"
target="_blank" class="learn-more-link"
hidden$="[[!destination.shouldShowInvalidCertificateError]]">
$i18n{learnMore}
</a>
<span class="extension-controlled-indicator"
......
......@@ -74,12 +74,6 @@ Polymer({
}
},
/** @private */
onLearnMoreLinkClick_: function() {
print_preview.NativeLayer.getInstance().forceOpenNewTab(
loadTimeData.getString('gcpCertificateErrorLearnMoreURL'));
},
// <if expr="chromeos">
/**
* Called if the printer configuration request is accepted. Show the waiting
......
......@@ -3,7 +3,6 @@
<link rel="import" href="chrome://resources/cr_elements/hidden_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/paper_button_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/action_link_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/util.html">
......@@ -26,7 +25,7 @@
<dom-module id="print-preview-preview-area">
<template>
<style include="print-preview-shared action-link cr-hidden-style">
<style include="print-preview-shared cr-hidden-style">
@keyframes dancing-dots-jump {
0% { top: 0; }
55% { top: 0; }
......@@ -119,9 +118,9 @@
hidden$="[[!isPreviewLoading_(previewState)]]">
<span>.</span><span>.</span><span>.</span>
</span>
<a is="action-link" class="learn-more-link"
hidden$="[[!shouldShowLearnMoreLink_(previewState)]]"
on-click="onGcpErrorLearnMoreClick_">
<a href="$i18n{gcpCertificateErrorLearnMoreURL}"
target="_blank" class="learn-more-link"
hidden$="[[!shouldShowLearnMoreLink_(previewState)]]">
$i18n{learnMore}
</a>
</div>
......
......@@ -539,17 +539,6 @@ Polymer({
this.pluginProxy_.setPointerEvents(!e.detail);
},
/**
* Called when the learn more link for a cloud destination with an invalid
* certificate is clicked. Calls nativeLayer to open a new tab with the help
* page.
* @private
*/
onGcpErrorLearnMoreClick_: function() {
this.nativeLayer_.forceOpenNewTab(
this.i18n('gcpCertificateErrorLearnMoreURL'));
},
/** @private */
onMarginsChanged_: function() {
if (this.getSettingValue('margins') !=
......
......@@ -1051,6 +1051,7 @@ void PrintPreviewHandler::HandleGetInitialSettings(
weak_factory_.GetWeakPtr(), callback_id));
}
// TODO(rbpotter): Remove this when the old Print Preview page is deleted.
void PrintPreviewHandler::HandleForceOpenNewTab(const base::ListValue* args) {
std::string url;
if (!args->GetString(0, &url))
......
......@@ -247,6 +247,7 @@ class PrintPreviewHandler
// Javascript's "window.open" opens a new window popup (since initiated from
// async HTTP request) and worse yet, on Windows and Chrome OS, the opened
// window opens behind the initiator window.
// TODO(rbpotter): Remove this when the old Print Preview page is deleted.
void HandleForceOpenNewTab(const base::ListValue* args);
void SendInitialSettings(const std::string& callback_id,
......
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