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