| Index: chrome/android/java/src/org/chromium/chrome/browser/printing/PrintingControllerFactory.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/printing/PrintingControllerFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/printing/PrintingControllerFactory.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..600975b58022e791f92e150c3ee4e38e3c891467
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/printing/PrintingControllerFactory.java
|
| @@ -0,0 +1,35 @@
|
| +// Copyright 2013 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.
|
| +
|
| +package org.chromium.chrome.browser.printing;
|
| +
|
| +import android.app.Activity;
|
| +import android.content.Context;
|
| +import android.print.PrintManager;
|
| +
|
| +import org.chromium.chrome.R;
|
| +import org.chromium.printing.PrintManagerDelegateImpl;
|
| +import org.chromium.printing.PrintingController;
|
| +import org.chromium.printing.PrintingControllerImpl;
|
| +
|
| +/**
|
| + * Creates a {@link PrintingControllerImpl}.
|
| + *
|
| + * Also, sets the default title of {@link TabPrinter}.
|
| + */
|
| +public class PrintingControllerFactory {
|
| + public static PrintingController create(Activity activity) {
|
| + if (PrintingControllerImpl.isPrintingSupported()) {
|
| + String defaultJobTitle = activity.getResources().getString(R.string.menu_print);
|
| + TabPrinter.setDefaultTitle(defaultJobTitle);
|
| +
|
| + PrintManager printManager =
|
| + (PrintManager) activity.getSystemService(Context.PRINT_SERVICE);
|
| + String errorText = activity.getResources().getString(R.string.error_printing_failed);
|
| + return PrintingControllerImpl.create(
|
| + new PrintManagerDelegateImpl(printManager), errorText);
|
| + }
|
| + return null;
|
| + }
|
| +}
|
|
|