Index: content/browser/android/dialog_android_overlay.h |
diff --git a/content/browser/android/dialog_android_overlay.h b/content/browser/android/dialog_android_overlay.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c5f26ccf2990eb8ef7c39e6e708abc1f57ae94c2 |
--- /dev/null |
+++ b/content/browser/android/dialog_android_overlay.h |
@@ -0,0 +1,54 @@ |
+// Copyright 2017 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 CONTENT_BROWSER_ANDROID_DIALOG_ANDROID_OVERLAY_H |
+#define CONTENT_BROWSER_ANDROID_DIALOG_ANDROID_OVERLAY_H |
+ |
+#include "base/android/jni_android.h" |
+#include "base/android/scoped_java_ref.h" |
+#include "content/browser/android/content_view_core_impl.h" |
+#include "content/browser/android/content_view_core_impl_observer.h" |
+ |
+namespace content { |
+ |
+// Native counterpart to DialogAndroidOverlay java class. This is created by |
+// the java class. When the ContentViewCore for the provided (renderer, frame) |
+// is attached to or detached from a WindowAndroid, we get the Android window |
+// token and notify the java class. |
+class DialogAndroidOverlay : public ContentViewCoreImplObserver { |
+ public: |
+ // Registers the JNI methods for ContentViewRender. |
+ static bool RegisterDialogAndroidOverlay(JNIEnv* env); |
+ |
+ // Construction, callable from a random thread. |
+ DialogAndroidOverlay(const base::android::JavaParamRef<jobject>& receiver, |
+ int renderer_pid, |
+ int render_frame_id); |
+ |
+ ~DialogAndroidOverlay() override; |
+ |
+ // ContentViewCoreImplObserver |
+ void OnContentViewCoreDestroyed() override; |
+ void OnAttachedToWindow() override; |
+ void OnDetachedFromWindow() override; |
+ |
+ private: |
+ // Finish init on the main thread. |
+ void CompleteInitialization(); |
+ |
+ // Look up the ContentViewCore for |renderer_pid_| and |render_frame_id_|. |
+ ContentViewCoreImpl* GetContentViewCore(); |
+ |
+ private: |
+ // Java object that owns us. |
+ base::android::ScopedJavaGlobalRef<jobject> receiver_; |
+ |
+ int renderer_pid_; |
+ int render_frame_id_; |
+ ContentViewCoreImpl* cvc_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_ANDROID_DIALOG_ANDROID_OVERLAY_H |