Chromium Code Reviews| 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_IMPL_H_ | |
| 6 #define CONTENT_BROWSER_ANDROID_DIALOG_OVERLAY_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 DialogOverlayImpl java class. This is created by the | |
| 17 // java side. When the ContentViewCore for the provided token is attached or | |
| 18 // detached from a WindowAndroid, we get the Android window token and notify the | |
| 19 // java side. | |
| 20 class DialogOverlayImpl : public ContentViewCoreImplObserver { | |
| 21 public: | |
| 22 // Registers the JNI methods for DialogOverlayImpl. | |
| 23 static bool RegisterDialogOverlayImpl(JNIEnv* env); | |
| 24 | |
| 25 DialogOverlayImpl(const base::android::JavaParamRef<jobject>& receiver, | |
| 26 const base::UnguessableToken& token); | |
| 27 | |
| 28 ~DialogOverlayImpl() override; | |
| 29 | |
| 30 // ContentViewCoreImplObserver | |
| 31 void OnContentViewCoreDestroyed() override; | |
| 32 void OnAttachedToWindow() override; | |
| 33 void OnDetachedFromWindow() override; | |
| 34 | |
| 35 // Unregister for tokens if we're registered, and clear |cvc_|. | |
| 36 void UnregisterForTokensIfNeeded(); | |
| 37 | |
| 38 private: | |
| 39 // Look up the ContentViewCore for |renderer_pid_| and |render_frame_id_|. | |
| 40 ContentViewCoreImpl* GetContentViewCore(); | |
| 41 | |
| 42 private: | |
| 
 
boliu
2017/04/26 00:19:08
nit: no need for double private
 
liberato (no reviews please)
2017/04/26 17:26:34
Done.
 
 | |
| 43 // Java object that owns us. | |
| 44 base::android::ScopedJavaGlobalRef<jobject> receiver_; | |
| 
 
boliu
2017/04/26 00:19:08
the convention is to call this obj_, when native a
 
liberato (no reviews please)
2017/04/26 17:26:34
done.
however, now i'm worried about the webview
 
boliu
2017/04/26 17:40:11
I would certainly hope so, but that's a question f
 
 | |
| 45 | |
| 46 base::UnguessableToken token_; | |
| 47 | |
| 48 // ContentViewCoreImpl instance that we're registered with as an observer. | |
| 49 ContentViewCoreImpl* cvc_; | |
| 50 }; | |
| 51 | |
| 52 } // namespace content | |
| 53 | |
| 54 #endif // CONTENT_BROWSER_ANDROID_DIALOG_OVERLAY_IMPL_H_ | |
| OLD | NEW |