OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/bottombar/overlay_panel_content.h" | 5 #include "chrome/browser/android/bottombar/overlay_panel_content.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // TODO(pedrosimonetti): Confirm with dtrainor@ if the comment above | 100 // TODO(pedrosimonetti): Confirm with dtrainor@ if the comment above |
101 // is accurate. | 101 // is accurate. |
102 web_contents_.reset(web_contents); | 102 web_contents_.reset(web_contents); |
103 // TODO(pedrosimonetti): confirm if we need this after promoting it | 103 // TODO(pedrosimonetti): confirm if we need this after promoting it |
104 // to a real tab. | 104 // to a real tab. |
105 TabAndroid::AttachTabHelpers(web_contents_.get()); | 105 TabAndroid::AttachTabHelpers(web_contents_.get()); |
106 web_contents_delegate_.reset( | 106 web_contents_delegate_.reset( |
107 new web_contents_delegate_android::WebContentsDelegateAndroid( | 107 new web_contents_delegate_android::WebContentsDelegateAndroid( |
108 env, jweb_contents_delegate)); | 108 env, jweb_contents_delegate)); |
109 web_contents_->SetDelegate(web_contents_delegate_.get()); | 109 web_contents_->SetDelegate(web_contents_delegate_.get()); |
110 } | |
111 | |
112 void OverlayPanelContent::SetViewAndroid( | |
113 JNIEnv* env, | |
114 const JavaParamRef<jobject>& obj, | |
115 const JavaParamRef<jobject>& jcontent_view_core) { | |
116 content::ContentViewCore* content_view_core = | |
117 content::ContentViewCore::GetNativeContentViewCore(env, | |
118 jcontent_view_core); | |
119 DCHECK(content_view_core); | |
120 | |
121 ViewAndroidHelper::FromWebContents(web_contents_.get()) | 110 ViewAndroidHelper::FromWebContents(web_contents_.get()) |
122 ->SetViewAndroid(content_view_core); | 111 ->SetViewAndroid(web_contents_->GetNativeView()); |
123 } | 112 } |
124 | 113 |
125 void OverlayPanelContent::DestroyWebContents( | 114 void OverlayPanelContent::DestroyWebContents( |
126 JNIEnv* env, | 115 JNIEnv* env, |
127 const JavaParamRef<jobject>& jobj) { | 116 const JavaParamRef<jobject>& jobj) { |
128 DCHECK(web_contents_.get()); | 117 DCHECK(web_contents_.get()); |
129 web_contents_.reset(); | 118 web_contents_.reset(); |
130 // |web_contents_delegate_| may already be NULL at this point. | 119 // |web_contents_delegate_| may already be NULL at this point. |
131 web_contents_delegate_.reset(); | 120 web_contents_delegate_.reset(); |
132 } | 121 } |
(...skipping 13 matching lines...) Expand all Loading... |
146 } | 135 } |
147 | 136 |
148 bool RegisterOverlayPanelContent(JNIEnv* env) { | 137 bool RegisterOverlayPanelContent(JNIEnv* env) { |
149 return RegisterNativesImpl(env); | 138 return RegisterNativesImpl(env); |
150 } | 139 } |
151 | 140 |
152 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 141 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
153 OverlayPanelContent* content = new OverlayPanelContent(env, obj); | 142 OverlayPanelContent* content = new OverlayPanelContent(env, obj); |
154 return reinterpret_cast<intptr_t>(content); | 143 return reinterpret_cast<intptr_t>(content); |
155 } | 144 } |
OLD | NEW |