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_OVERLAY_OPERATIONS_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_DIALOG_OVERLAY_OPERATIONS_IMPL_H_ |
| 7 |
| 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/unguessable_token.h" |
| 11 #include "content/browser/android/content_view_core_impl.h" |
| 12 #include "content/browser/android/content_view_core_impl_observer.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // Native counterpart to DialogOverlayOperationsImpl java class. This is |
| 17 // created by the java class. When the ContentViewCore for the provided token |
| 18 // is attached to or detached from a WindowAndroid, we get the Android window |
| 19 // token and notify the java class. |
| 20 class DialogOverlayOperationsImpl : public ContentViewCoreImplObserver { |
| 21 public: |
| 22 // Registers the JNI methods for DialogOverlayOperationsImpl. |
| 23 static bool RegisterDialogOverlayOperationsImpl(JNIEnv* env); |
| 24 |
| 25 DialogOverlayOperationsImpl( |
| 26 const base::android::JavaParamRef<jobject>& receiver, |
| 27 const base::UnguessableToken& token); |
| 28 |
| 29 ~DialogOverlayOperationsImpl() override; |
| 30 |
| 31 // ContentViewCoreImplObserver |
| 32 void OnContentViewCoreDestroyed() override; |
| 33 void OnAttachedToWindow() override; |
| 34 void OnDetachedFromWindow() override; |
| 35 |
| 36 // Unregister for tokens if we're registered, and clear |cvc_|. |
| 37 void UnregisterForTokensIfNeeded(); |
| 38 |
| 39 private: |
| 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 base::UnguessableToken token_; |
| 48 |
| 49 // ContentViewCoreImpl instance that we're registered with as an observer. |
| 50 ContentViewCoreImpl* cvc_; |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 |
| 55 #endif // CONTENT_BROWSER_ANDROID_DIALOG_OVERLAY_OPERATIONS_IMPL_H_ |
OLD | NEW |