summaryrefslogtreecommitdiff
path: root/chromium/pdf/ppapi_migration
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/pdf/ppapi_migration')
-rw-r--r--chromium/pdf/ppapi_migration/README.md5
-rw-r--r--chromium/pdf/ppapi_migration/geometry_conversions.cc23
-rw-r--r--chromium/pdf/ppapi_migration/geometry_conversions.h23
3 files changed, 51 insertions, 0 deletions
diff --git a/chromium/pdf/ppapi_migration/README.md b/chromium/pdf/ppapi_migration/README.md
new file mode 100644
index 00000000000..f6426f94eba
--- /dev/null
+++ b/chromium/pdf/ppapi_migration/README.md
@@ -0,0 +1,5 @@
+# PPAPI migration utilities
+
+This directory contains utilities for bridging from legacy APIs during the PDF
+viewer's [migration from Pepper](https://crbug.com/702993). The utilities should
+be designed for easy removal once the migration is complete.
diff --git a/chromium/pdf/ppapi_migration/geometry_conversions.cc b/chromium/pdf/ppapi_migration/geometry_conversions.cc
new file mode 100644
index 00000000000..a6399e04938
--- /dev/null
+++ b/chromium/pdf/ppapi_migration/geometry_conversions.cc
@@ -0,0 +1,23 @@
+// Copyright 2020 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.
+
+#include "pdf/ppapi_migration/geometry_conversions.h"
+
+#include "ppapi/c/pp_rect.h"
+#include "ppapi/c/pp_size.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace chrome_pdf {
+
+gfx::Rect RectFromPPRect(const PP_Rect& pp_rect) {
+ return gfx::Rect(pp_rect.point.x, pp_rect.point.y, pp_rect.size.width,
+ pp_rect.size.height);
+}
+
+gfx::Size SizeFromPPSize(const PP_Size& pp_size) {
+ return gfx::Size(pp_size.width, pp_size.height);
+}
+
+} // namespace chrome_pdf
diff --git a/chromium/pdf/ppapi_migration/geometry_conversions.h b/chromium/pdf/ppapi_migration/geometry_conversions.h
new file mode 100644
index 00000000000..8806207abc7
--- /dev/null
+++ b/chromium/pdf/ppapi_migration/geometry_conversions.h
@@ -0,0 +1,23 @@
+// Copyright 2020 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 PDF_PPAPI_MIGRATION_GEOMETRY_CONVERSIONS_H_
+#define PDF_PPAPI_MIGRATION_GEOMETRY_CONVERSIONS_H_
+
+struct PP_Rect;
+struct PP_Size;
+
+namespace gfx {
+class Rect;
+class Size;
+} // namespace gfx
+
+namespace chrome_pdf {
+
+gfx::Rect RectFromPPRect(const PP_Rect& pp_rect);
+gfx::Size SizeFromPPSize(const PP_Size& pp_size);
+
+} // namespace chrome_pdf
+
+#endif // PDF_PPAPI_MIGRATION_GEOMETRY_CONVERSIONS_H_