OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ANDROID_DIALOG_ANDROID_OVERLAY_H |
| 6 #define CONTENT_BROWSER_ANDROID_DIALOG_ANDROID_OVERLAY_H |
| 7 |
| 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "content/browser/android/content_view_core_impl.h" |
| 11 #include "content/browser/android/content_view_core_impl_observer.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 // Native counterpart to DialogAndroidOverlay java class. This is created by |
| 16 // the java class. When the ContentViewCore for the provided (renderer, frame) |
| 17 // is attached to or detached from a WindowAndroid, we get the Android window |
| 18 // token and notify the java class. |
| 19 class DialogAndroidOverlay : public ContentViewCoreImplObserver { |
| 20 public: |
| 21 // Registers the JNI methods for ContentViewRender. |
| 22 static bool RegisterDialogAndroidOverlay(JNIEnv* env); |
| 23 |
| 24 // Construction, callable from a random thread. |
| 25 DialogAndroidOverlay(const base::android::JavaParamRef<jobject>& receiver, |
| 26 int renderer_pid, |
| 27 int render_frame_id); |
| 28 |
| 29 ~DialogAndroidOverlay() override; |
| 30 |
| 31 // ContentViewCoreImplObserver |
| 32 void OnContentViewCoreDestroyed() override; |
| 33 void OnAttachedToWindow() override; |
| 34 void OnDetachedFromWindow() override; |
| 35 |
| 36 private: |
| 37 // Finish init on the main thread. |
| 38 void CompleteInitialization(); |
| 39 |
| 40 // Look up the ContentViewCore for |renderer_pid_| and |render_frame_id_|. |
| 41 ContentViewCoreImpl* GetContentViewCore(); |
| 42 |
| 43 private: |
| 44 // Java object that owns us. |
| 45 base::android::ScopedJavaGlobalRef<jobject> receiver_; |
| 46 |
| 47 int renderer_pid_; |
| 48 int render_frame_id_; |
| 49 ContentViewCoreImpl* cvc_; |
| 50 }; |
| 51 |
| 52 } // namespace content |
| 53 |
| 54 #endif // CONTENT_BROWSER_ANDROID_DIALOG_ANDROID_OVERLAY_H |
OLD | NEW |