Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7986)

Unified Diff: chrome/browser/resources/print_preview/search/cloud_destination_list.js

Issue 10450022: Print Preview Print Destination Search Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Set --bary flag Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/search/cloud_destination_list.js
diff --git a/chrome/browser/resources/print_preview/search/cloud_destination_list.js b/chrome/browser/resources/print_preview/search/cloud_destination_list.js
new file mode 100644
index 0000000000000000000000000000000000000000..a5b7c9203091d91e09a3f46be165cd58e7191d91
--- /dev/null
+++ b/chrome/browser/resources/print_preview/search/cloud_destination_list.js
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('print_preview', function() {
+ 'use strict';
+
+ /**
+ * Sub-class of a destination list that shows cloud-based destinations.
+ * @param {!cr.EventTarget} eventTarget Event target to pass to destination
+ * items for dispatching SELECT events.
+ * @constructor
+ * @extends {print_preview.DestinationList}
+ */
+ function CloudDestinationList(eventTarget) {
+ print_preview.DestinationList.call(
+ this,
+ eventTarget,
+ localStrings.getString('cloudDestinationsTitle'),
+ 0 /*opt_maxSize*/,
+ localStrings.getString('manage'));
+ };
+
+ CloudDestinationList.prototype = {
+ __proto__: print_preview.DestinationList.prototype,
+
+ /** @override */
+ updateDestinations: function(destinations) {
+ // Change the action link from "Manage..." to "Setup..." if user only has
+ // Docs and FedEx printers.
+ var docsId = print_preview.Destination.GooglePromotedId.DOCS;
+ var fedexId = print_preview.Destination.GooglePromotedId.FEDEX;
+ if ((destinations.length == 1 && destinations[0].id == docsId) ||
+ (destinations.length == 2 &&
+ ((destinations[0].id == docsId && destinations[1].id == fedexId) ||
+ (destinations[0].id == fedexId && destinations[1].id == docsId)))) {
+ this.setActionLinkTextInternal(
+ localStrings.getString('setupCloudPrinters'));
+ } else {
+ this.setActionLinkTextInternal(localStrings.getString('manage'));
+ }
+ print_preview.DestinationList.prototype.updateDestinations.call(
+ this, destinations);
+ }
+ };
+
+ return {
+ CloudDestinationList: CloudDestinationList
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698