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

Unified Diff: printing/printing_context_android.h

Issue 23116003: Adds PrintingContext implementation stub for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses code review issues. Solves infinite recursion bug. Improves the interface between Java an… Created 7 years, 4 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: printing/printing_context_android.h
diff --git a/printing/printing_context_android.h b/printing/printing_context_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..18c5b422ba4c392e2d9ae0989f46cfb3333b260d
--- /dev/null
+++ b/printing/printing_context_android.h
@@ -0,0 +1,63 @@
+// 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.
+
+#ifndef PRINTING_PRINTING_CONTEXT_ANDROID_H_
+#define PRINTING_PRINTING_CONTEXT_ANDROID_H_
+
+#include <jni.h>
+
+#include <string>
+
+#include "base/android/scoped_java_ref.h"
+#include "printing/printing_context.h"
+
+namespace printing {
+
+class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {
whywhat 2013/08/16 23:31:36 nit: class-level comment?
cimamoglu1 2013/08/19 13:47:26 Done.
+ public:
+ explicit PrintingContextAndroid(const std::string& app_locale);
+ virtual ~PrintingContextAndroid();
+
+ // Called when writing a page to a PDF operation for a particular file
whywhat 2013/08/16 23:31:36 nit: Called when the page is successfully written
cimamoglu1 2013/08/19 13:47:26 Done.
+ // descriptor is done, either successfully or not.
+ static void PdfWritingDone(int fd, bool success);
+
+ // Called from Java, when printing settings from the user is ready or the
whywhat 2013/08/16 23:31:36 nit: s/is/are/
cimamoglu1 2013/08/19 13:47:26 Done.
+ // printing operation is canceled.
+ void AskUserForSettingsReply(bool success);
+
+ // PrintingContext implementation.
+ virtual void AskUserForSettings(
+ gfx::NativeView parent_view,
+ int max_pages,
+ bool has_selection,
+ const PrintSettingsCallback& callback) OVERRIDE;
+ virtual Result UseDefaultSettings() OVERRIDE;
+ virtual Result UpdatePrinterSettings(
+ const base::DictionaryValue& job_settings,
+ const PageRanges& ranges) OVERRIDE;
+ virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE;
+ virtual Result NewDocument(const string16& document_name) OVERRIDE;
+ virtual Result NewPage() OVERRIDE;
+ virtual Result PageDone() OVERRIDE;
+ virtual Result DocumentDone() OVERRIDE;
+ virtual void Cancel() OVERRIDE;
+ virtual void ReleaseContext() OVERRIDE;
+ virtual gfx::NativeDrawingContext context() const OVERRIDE;
+
+ static bool RegisterPrintingContext(JNIEnv* env);
+
+ private:
+ base::android::ScopedJavaGlobalRef<jobject> j_printing_context_;
+
+ // The callback from AskUserForSettings to be called upon the reply from Java.
whywhat 2013/08/16 23:31:36 nit: s/upon the reply from Java/when the settings
cimamoglu1 2013/08/19 13:47:26 Done.
+ PrintSettingsCallback callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid);
+};
+
+} // namespace printing
+
+#endif // PRINTING_PRINTING_CONTEXT_ANDROID_H_
+

Powered by Google App Engine
This is Rietveld 408576698