OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 struct MenuItem; | 42 struct MenuItem; |
43 | 43 |
44 class ContentViewCoreImpl : public ContentViewCore, | 44 class ContentViewCoreImpl : public ContentViewCore, |
45 public WebContentsObserver { | 45 public WebContentsObserver { |
46 public: | 46 public: |
47 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 47 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
48 ContentViewCoreImpl( | 48 ContentViewCoreImpl( |
49 JNIEnv* env, | 49 JNIEnv* env, |
50 const base::android::JavaRef<jobject>& obj, | 50 const base::android::JavaRef<jobject>& obj, |
51 WebContents* web_contents, | 51 WebContents* web_contents, |
| 52 ImeAdapterAndroid* ime_adapter, |
52 float dpi_scale, | 53 float dpi_scale, |
53 const base::android::JavaRef<jobject>& java_bridge_retained_object_set); | 54 const base::android::JavaRef<jobject>& java_bridge_retained_object_set); |
54 | 55 |
55 // ContentViewCore implementation. | 56 // ContentViewCore implementation. |
56 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 57 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
57 WebContents* GetWebContents() const override; | 58 WebContents* GetWebContents() const override; |
58 ui::WindowAndroid* GetWindowAndroid() const override; | 59 ui::WindowAndroid* GetWindowAndroid() const override; |
59 bool ShowPastePopup(const ContextMenuParams& params) override; | 60 bool ShowPastePopup(const ContextMenuParams& params) override; |
60 | 61 |
61 void AddObserver(ContentViewCoreImplObserver* observer); | 62 void AddObserver(ContentViewCoreImplObserver* observer); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 const base::android::JavaParamRef<jobject>& obj); | 167 const base::android::JavaParamRef<jobject>& obj); |
167 void SetDoubleTapSupportEnabled( | 168 void SetDoubleTapSupportEnabled( |
168 JNIEnv* env, | 169 JNIEnv* env, |
169 const base::android::JavaParamRef<jobject>& obj, | 170 const base::android::JavaParamRef<jobject>& obj, |
170 jboolean enabled); | 171 jboolean enabled); |
171 void SetMultiTouchZoomSupportEnabled( | 172 void SetMultiTouchZoomSupportEnabled( |
172 JNIEnv* env, | 173 JNIEnv* env, |
173 const base::android::JavaParamRef<jobject>& obj, | 174 const base::android::JavaParamRef<jobject>& obj, |
174 jboolean enabled); | 175 jboolean enabled); |
175 | 176 |
176 long GetNativeImeAdapter(JNIEnv* env, | |
177 const base::android::JavaParamRef<jobject>& obj); | |
178 void SetFocus(JNIEnv* env, | 177 void SetFocus(JNIEnv* env, |
179 const base::android::JavaParamRef<jobject>& obj, | 178 const base::android::JavaParamRef<jobject>& obj, |
180 jboolean focused); | 179 jboolean focused); |
181 | 180 |
182 void SetDIPScale(JNIEnv* env, | 181 void SetDIPScale(JNIEnv* env, |
183 const base::android::JavaParamRef<jobject>& obj, | 182 const base::android::JavaParamRef<jobject>& obj, |
184 jfloat dipScale); | 183 jfloat dipScale); |
185 | 184 |
186 jint GetBackgroundColor(JNIEnv* env, jobject obj); | 185 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
187 void SetAllowJavascriptInterfacesInspection( | 186 void SetAllowJavascriptInterfacesInspection( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset, | 259 void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset, |
261 float page_scale_factor, | 260 float page_scale_factor, |
262 const gfx::Vector2dF& page_scale_factor_limits, | 261 const gfx::Vector2dF& page_scale_factor_limits, |
263 const gfx::SizeF& content_size, | 262 const gfx::SizeF& content_size, |
264 const gfx::SizeF& viewport_size, | 263 const gfx::SizeF& viewport_size, |
265 const float top_controls_height, | 264 const float top_controls_height, |
266 const float top_controls_shown_ratio, | 265 const float top_controls_shown_ratio, |
267 bool is_mobile_optimized_hint, | 266 bool is_mobile_optimized_hint, |
268 const gfx::SelectionBound& selection_start); | 267 const gfx::SelectionBound& selection_start); |
269 | 268 |
270 void ForceUpdateImeAdapter(long native_ime_adapter); | 269 void UpdateImeAdapter(int text_input_type, |
271 void UpdateImeAdapter(long native_ime_adapter, | |
272 int text_input_type, | |
273 int text_input_flags, | 270 int text_input_flags, |
274 int text_input_mode, | 271 int text_input_mode, |
275 const std::string& text, | 272 const std::string& text, |
276 int selection_start, | 273 int selection_start, |
277 int selection_end, | 274 int selection_end, |
278 int composition_start, | 275 int composition_start, |
279 int composition_end, | 276 int composition_end, |
280 bool show_ime_if_needed, | 277 bool show_ime_if_needed, |
281 bool reply_to_request); | 278 bool reply_to_request); |
282 | 279 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 float GetBottomControlsHeightDip() const; | 323 float GetBottomControlsHeightDip() const; |
327 | 324 |
328 void MoveRangeSelectionExtent(const gfx::PointF& extent); | 325 void MoveRangeSelectionExtent(const gfx::PointF& extent); |
329 | 326 |
330 void SelectBetweenCoordinates(const gfx::PointF& base, | 327 void SelectBetweenCoordinates(const gfx::PointF& base, |
331 const gfx::PointF& extent); | 328 const gfx::PointF& extent); |
332 | 329 |
333 void OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip); | 330 void OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip); |
334 void OnTouchDown(const base::android::ScopedJavaLocalRef<jobject>& event); | 331 void OnTouchDown(const base::android::ScopedJavaLocalRef<jobject>& event); |
335 | 332 |
| 333 ImeAdapterAndroid* ime_adapter() { return ime_adapter_; } |
| 334 |
336 ui::ViewAndroid* GetViewAndroid() const; | 335 ui::ViewAndroid* GetViewAndroid() const; |
337 | 336 |
338 private: | 337 private: |
339 class ContentViewUserData; | 338 class ContentViewUserData; |
340 | 339 |
341 friend class ContentViewUserData; | 340 friend class ContentViewUserData; |
342 ~ContentViewCoreImpl() override; | 341 ~ContentViewCoreImpl() override; |
343 | 342 |
344 // WebContentsObserver implementation. | 343 // WebContentsObserver implementation. |
345 void RenderViewReady() override; | 344 void RenderViewReady() override; |
346 void RenderViewHostChanged(RenderViewHost* old_host, | 345 void RenderViewHostChanged(RenderViewHost* old_host, |
347 RenderViewHost* new_host) override; | 346 RenderViewHost* new_host) override; |
| 347 void DidDetachInterstitialPage() override; |
348 void WebContentsDestroyed() override; | 348 void WebContentsDestroyed() override; |
349 | 349 |
350 // -------------------------------------------------------------------------- | 350 // -------------------------------------------------------------------------- |
351 // Other private methods and data | 351 // Other private methods and data |
352 // -------------------------------------------------------------------------- | 352 // -------------------------------------------------------------------------- |
353 | 353 |
354 void InitWebContents(); | 354 void InitWebContents(); |
355 void SendScreenRectsAndResizeWidget(); | 355 void SendScreenRectsAndResizeWidget(); |
356 | 356 |
357 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; | 357 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid() const; |
(...skipping 20 matching lines...) Expand all Loading... |
378 // A weak reference to the Java ContentViewCore object. | 378 // A weak reference to the Java ContentViewCore object. |
379 JavaObjectWeakGlobalRef java_ref_; | 379 JavaObjectWeakGlobalRef java_ref_; |
380 | 380 |
381 // Select popup view | 381 // Select popup view |
382 ui::ViewAndroid::ScopedAnchorView select_popup_; | 382 ui::ViewAndroid::ScopedAnchorView select_popup_; |
383 | 383 |
384 // Reference to the current WebContents used to determine how and what to | 384 // Reference to the current WebContents used to determine how and what to |
385 // display in the ContentViewCore. | 385 // display in the ContentViewCore. |
386 WebContentsImpl* web_contents_; | 386 WebContentsImpl* web_contents_; |
387 | 387 |
| 388 ImeAdapterAndroid* const ime_adapter_; |
| 389 |
388 // Page scale factor. | 390 // Page scale factor. |
389 float page_scale_; | 391 float page_scale_; |
390 | 392 |
391 // Device scale factor. | 393 // Device scale factor. |
392 float dpi_scale_; | 394 float dpi_scale_; |
393 | 395 |
394 // Observer to notify of lifecyle changes. | 396 // Observer to notify of lifecyle changes. |
395 base::ObserverList<ContentViewCoreImplObserver> observer_list_; | 397 base::ObserverList<ContentViewCoreImplObserver> observer_list_; |
396 | 398 |
397 // The cache of device's current orientation set from Java side, this value | 399 // The cache of device's current orientation set from Java side, this value |
398 // will be sent to Renderer once it is ready. | 400 // will be sent to Renderer once it is ready. |
399 int device_orientation_; | 401 int device_orientation_; |
400 | 402 |
401 bool accessibility_enabled_; | 403 bool accessibility_enabled_; |
402 | 404 |
403 // Manages injecting Java objects. | 405 // Manages injecting Java objects. |
404 scoped_refptr<GinJavaBridgeDispatcherHost> java_bridge_dispatcher_host_; | 406 scoped_refptr<GinJavaBridgeDispatcherHost> java_bridge_dispatcher_host_; |
405 | 407 |
406 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 408 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
407 }; | 409 }; |
408 | 410 |
409 bool RegisterContentViewCore(JNIEnv* env); | 411 bool RegisterContentViewCore(JNIEnv* env); |
410 | 412 |
411 } // namespace content | 413 } // namespace content |
412 | 414 |
413 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 415 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |