Disallow ManagePasswordsUIControllerMock to delete ManagePasswordsUIController silently.
[chromium-blink-merge.git] / printing / printing_context_android.h
blob32f11be7b766d1795c6df56aeb95aaa2c67b2386
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.
5 #ifndef PRINTING_PRINTING_CONTEXT_ANDROID_H_
6 #define PRINTING_PRINTING_CONTEXT_ANDROID_H_
8 #include <jni.h>
10 #include <string>
12 #include "base/android/scoped_java_ref.h"
13 #include "printing/printing_context.h"
15 namespace printing {
17 // Android subclass of PrintingContext. The implementation for this header file
18 // resides in Chrome for Android repository. This class communicates with the
19 // Java side through JNI.
20 class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {
21 public:
22 explicit PrintingContextAndroid(Delegate* delegate);
23 virtual ~PrintingContextAndroid();
25 // Called when the page is successfully written to a PDF using the file
26 // descriptor specified, or when the printing operation failed.
27 static void PdfWritingDone(int fd, bool success);
29 // Called from Java, when printing settings from the user are ready or the
30 // printing operation is canceled.
31 void AskUserForSettingsReply(JNIEnv* env, jobject obj, jboolean success);
33 // PrintingContext implementation.
34 virtual void AskUserForSettings(
35 int max_pages,
36 bool has_selection,
37 const PrintSettingsCallback& callback) override;
38 virtual Result UseDefaultSettings() override;
39 virtual gfx::Size GetPdfPaperSizeDeviceUnits() override;
40 virtual Result UpdatePrinterSettings(bool external_preview,
41 bool show_system_dialog) override;
42 virtual Result InitWithSettings(const PrintSettings& settings) override;
43 virtual Result NewDocument(const base::string16& document_name) override;
44 virtual Result NewPage() override;
45 virtual Result PageDone() override;
46 virtual Result DocumentDone() override;
47 virtual void Cancel() override;
48 virtual void ReleaseContext() override;
49 virtual gfx::NativeDrawingContext context() const override;
51 // Registers JNI bindings for RegisterContext.
52 static bool RegisterPrintingContext(JNIEnv* env);
54 private:
55 base::android::ScopedJavaGlobalRef<jobject> j_printing_context_;
57 // The callback from AskUserForSettings to be called when the settings are
58 // ready on the Java side
59 PrintSettingsCallback callback_;
61 DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid);
64 } // namespace printing
66 #endif // PRINTING_PRINTING_CONTEXT_ANDROID_H_