1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.chrome.browser.printing; 6 7 import android.content.Context; 8 9 import org.chromium.base.ApiCompatibilityUtils; 10 import org.chromium.chrome.R; 11 import org.chromium.printing.PrintDocumentAdapterWrapper; 12 import org.chromium.printing.PrintingController; 13 import org.chromium.printing.PrintingControllerImpl; 14 15 /** 16 * Creates a {@link PrintingControllerImpl}. 17 * 18 * Also, sets the default title of {@link TabPrinter}. 19 */ 20 public class PrintingControllerFactory { 21 public static PrintingController create(Context context) { 22 if (ApiCompatibilityUtils.isPrintingSupported()) { 23 String defaultJobTitle = context.getResources().getString(R.string.menu_print); 24 TabPrinter.setDefaultTitle(defaultJobTitle); 25 26 String errorText = context.getResources().getString(R.string.error_printing_failed); 27 return PrintingControllerImpl.create(new PrintDocumentAdapterWrapper(), errorText); 28 } 29 return null; 30 } 31 } 32