Chromium Code Reviews| Index: content/browser/android/dialog_overlay_impl.h | 
| diff --git a/content/browser/android/dialog_overlay_impl.h b/content/browser/android/dialog_overlay_impl.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..062196ba746102e4694174cb4c188b3de30ce919 | 
| --- /dev/null | 
| +++ b/content/browser/android/dialog_overlay_impl.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_OVERLAY_IMPL_H_ | 
| +#define CONTENT_BROWSER_ANDROID_DIALOG_OVERLAY_IMPL_H_ | 
| + | 
| +#include "base/android/jni_android.h" | 
| +#include "base/android/scoped_java_ref.h" | 
| +#include "base/unguessable_token.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 DialogOverlayImpl java class. This is created by the | 
| +// java side. When the ContentViewCore for the provided token is attached or | 
| +// detached from a WindowAndroid, we get the Android window token and notify the | 
| +// java side. | 
| +class DialogOverlayImpl : public ContentViewCoreImplObserver { | 
| + public: | 
| + // Registers the JNI methods for DialogOverlayImpl. | 
| + static bool RegisterDialogOverlayImpl(JNIEnv* env); | 
| + | 
| + DialogOverlayImpl(const base::android::JavaParamRef<jobject>& receiver, | 
| + const base::UnguessableToken& token); | 
| + | 
| + ~DialogOverlayImpl() override; | 
| + | 
| + // ContentViewCoreImplObserver | 
| + void OnContentViewCoreDestroyed() override; | 
| + void OnAttachedToWindow() override; | 
| + void OnDetachedFromWindow() override; | 
| + | 
| + // Unregister for tokens if we're registered, and clear |cvc_|. | 
| + void UnregisterForTokensIfNeeded(); | 
| + | 
| + private: | 
| + // Look up the ContentViewCore for |renderer_pid_| and |render_frame_id_|. | 
| + ContentViewCoreImpl* GetContentViewCore(); | 
| + | 
| + 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.
 
 | 
| + // Java object that owns us. | 
| + 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
 
 | 
| + | 
| + base::UnguessableToken token_; | 
| + | 
| + // ContentViewCoreImpl instance that we're registered with as an observer. | 
| + ContentViewCoreImpl* cvc_; | 
| +}; | 
| + | 
| +} // namespace content | 
| + | 
| +#endif // CONTENT_BROWSER_ANDROID_DIALOG_OVERLAY_IMPL_H_ |