Commit e3fbdad1 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Print Preview: Convert "Manage" link to a link from action-link

This no longer needs to be an action-link, since it is not opening
native dialogs or going through the C++ handler to correctly open cloud
print URLs with the correct user information. Instead, it is always
opening the chrome://settings printing page. This can be handled more
simply by using a normal link.

Bug: None
Change-Id: I9375ae0ac0c936aec379270f79f6130d054c1dcf
Reviewed-on: https://chromium-review.googlesource.com/c/1278527Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599273}
parent 695bc51a
...@@ -272,6 +272,7 @@ cr.define('print_preview', function() { ...@@ -272,6 +272,7 @@ cr.define('print_preview', function() {
/** /**
* Navigates the user to the Chrome printing setting page to manage local * Navigates the user to the Chrome printing setting page to manage local
* printers and Google cloud printers. * printers and Google cloud printers.
* TODO (rbpotter): Delete this when the old Print Preview page is removed.
*/ */
managePrinters() { managePrinters() {
chrome.send('managePrinters'); chrome.send('managePrinters');
......
...@@ -308,7 +308,6 @@ js_library("destination_dialog") { ...@@ -308,7 +308,6 @@ js_library("destination_dialog") {
js_library("destination_list") { js_library("destination_list") {
deps = [ deps = [
":destination_list_item", ":destination_list_item",
"..:native_layer",
"../data:destination", "../data:destination",
"//ui/webui/resources/js:i18n_behavior", "//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js:list_property_update_behavior", "//ui/webui/resources/js:list_property_update_behavior",
......
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
</print-preview-destination-list> </print-preview-destination-list>
<print-preview-destination-list id="printList" <print-preview-destination-list id="printList"
destinations="[[destinations_]]" destinations="[[destinations_]]"
has-action-link loading-destinations="[[loadingDestinations_]]" has-manage-link loading-destinations="[[loadingDestinations_]]"
search-query="[[searchQuery_]]" search-query="[[searchQuery_]]"
list-name="$i18n{printDestinationsTitle}" list-name="$i18n{printDestinationsTitle}"
on-destination-selected="onDestinationSelected_"> on-destination-selected="onDestinationSelected_">
......
...@@ -2,12 +2,9 @@ ...@@ -2,12 +2,9 @@
<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/action_link.html">
<link rel="import" href="chrome://resources/html/action_link_css.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/list_property_update_behavior.html"> <link rel="import" href="chrome://resources/html/list_property_update_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.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="destination_list_item.html"> <link rel="import" href="destination_list_item.html">
<link rel="import" href="print_preview_shared_css.html"> <link rel="import" href="print_preview_shared_css.html">
...@@ -16,7 +13,7 @@ ...@@ -16,7 +13,7 @@
<dom-module id="print-preview-destination-list"> <dom-module id="print-preview-destination-list">
<template> <template>
<style include="print-preview-shared action-link cr-hidden-style throbber"> <style include="print-preview-shared cr-hidden-style throbber">
:host { :host {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -45,12 +42,12 @@ ...@@ -45,12 +42,12 @@
padding-bottom: 8px; padding-bottom: 8px;
} }
:-webkit-any(.action-link, .total) { :-webkit-any(.link, .total) {
display: inline; display: inline;
padding: 0 4px; padding: 0 4px;
} }
.action-link { .link {
margin: 0 2px; margin: 0 2px;
} }
...@@ -91,8 +88,8 @@ ...@@ -91,8 +88,8 @@
<span class="total" hidden$="[[!showDestinationsTotal_]]"> <span class="total" hidden$="[[!showDestinationsTotal_]]">
[[i18n('destinationCount', matchingDestinations_.length)]] [[i18n('destinationCount', matchingDestinations_.length)]]
</span> </span>
<a is="action-link" class="action-link" hidden$="[[!hasActionLink]]" <a href="$i18n{settingsPrintingPage}" target="_none"
on-click="onActionLinkClick_"> class="link" hidden$="[[!hasManageLink]]">
$i18n{manage} $i18n{manage}
</a> </a>
<div class="throbber-container" hidden$="[[!loadingDestinations]]"> <div class="throbber-container" hidden$="[[!loadingDestinations]]">
......
...@@ -18,7 +18,7 @@ Polymer({ ...@@ -18,7 +18,7 @@ Polymer({
searchQuery: Object, searchQuery: Object,
/** @type {boolean} */ /** @type {boolean} */
hasActionLink: { hasManageLink: {
type: Boolean, type: Boolean,
value: false, value: false,
}, },
...@@ -112,11 +112,6 @@ Polymer({ ...@@ -112,11 +112,6 @@ Polymer({
this.showDestinationsTotal_ = count > 4; this.showDestinationsTotal_ = count > 4;
}, },
/** @private */
onActionLinkClick_: function() {
print_preview.NativeLayer.getInstance().managePrinters();
},
/** /**
* @param {!KeyboardEvent} e Event containing the destination and key. * @param {!KeyboardEvent} e Event containing the destination and key.
* @private * @private
......
...@@ -975,6 +975,7 @@ void PrintPreviewHandler::HandleGetAccessToken(const base::ListValue* args) { ...@@ -975,6 +975,7 @@ void PrintPreviewHandler::HandleGetAccessToken(const base::ListValue* args) {
token_service_->RequestToken(type, callback_id); token_service_->RequestToken(type, callback_id);
} }
// TODO (rbpotter): Remove this when the old Print Preview page is deleted.
void PrintPreviewHandler::HandleManagePrinters(const base::ListValue* args) { void PrintPreviewHandler::HandleManagePrinters(const base::ListValue* args) {
GURL local_printers_manage_url( GURL local_printers_manage_url(
chrome::GetSettingsUrl(chrome::kPrintingSettingsSubPage)); chrome::GetSettingsUrl(chrome::kPrintingSettingsSubPage));
......
...@@ -229,6 +229,7 @@ class PrintPreviewHandler ...@@ -229,6 +229,7 @@ class PrintPreviewHandler
// Brings up Chrome printing setting page to allow the user to configure local // Brings up Chrome printing setting page to allow the user to configure local
// printers or Google Cloud printers. |args| is unused. // printers or Google Cloud printers. |args| is unused.
// TODO (rbpotter): Remove this when the old Print Preview page is deleted.
void HandleManagePrinters(const base::ListValue* args); void HandleManagePrinters(const base::ListValue* args);
// Gathers UMA stats when the print preview dialog is about to close. // Gathers UMA stats when the print preview dialog is about to close.
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "chrome/browser/printing/background_printing_manager.h" #include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/print_preview_data_service.h" #include "chrome/browser/printing/print_preview_data_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/webui/metrics_handler.h" #include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
#include "chrome/browser/ui/webui/theme_source.h" #include "chrome/browser/ui/webui/theme_source.h"
...@@ -251,6 +252,9 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) { ...@@ -251,6 +252,9 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
source->AddString( source->AddString(
"noDestsPromoLearnMoreUrl", "noDestsPromoLearnMoreUrl",
chrome::kCloudPrintNoDestinationsLearnMoreURL); chrome::kCloudPrintNoDestinationsLearnMoreURL);
source->AddString(
"settingsPrintingPage",
chrome::GetSettingsUrl(chrome::kPrintingSettingsSubPage).spec());
source->AddString("gcpCertificateErrorLearnMoreURL", source->AddString("gcpCertificateErrorLearnMoreURL",
chrome::kCloudPrintCertificateErrorLearnMoreURL); chrome::kCloudPrintCertificateErrorLearnMoreURL);
source->AddLocalizedString("pageRangeLimitInstruction", source->AddLocalizedString("pageRangeLimitInstruction",
......
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