summaryrefslogtreecommitdiffstats
path: root/chromium/content/browser/android/content_view_core_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/android/content_view_core_impl.h')
-rw-r--r--chromium/content/browser/android/content_view_core_impl.h180
1 files changed, 86 insertions, 94 deletions
diff --git a/chromium/content/browser/android/content_view_core_impl.h b/chromium/content/browser/android/content_view_core_impl.h
index 5c61ae60b6d..3bb12913975 100644
--- a/chromium/content/browser/android/content_view_core_impl.h
+++ b/chromium/content/browser/android/content_view_core_impl.h
@@ -8,8 +8,7 @@
#include <vector>
#include "base/android/jni_android.h"
-#include "base/android/jni_helper.h"
-#include "base/basictypes.h"
+#include "base/android/jni_weak_ref.h"
#include "base/compiler_specific.h"
#include "base/i18n/rtl.h"
#include "base/memory/scoped_ptr.h"
@@ -17,8 +16,6 @@
#include "content/browser/renderer_host/render_widget_host_view_android.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/android/content_view_core.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/gfx/rect.h"
@@ -31,21 +28,21 @@ class WindowAndroid;
}
namespace content {
+class JavaBridgeDispatcherHostManager;
class RenderWidgetHostViewAndroid;
struct MenuItem;
// TODO(jrg): this is a shell. Upstream the rest.
class ContentViewCoreImpl : public ContentViewCore,
- public NotificationObserver,
public WebContentsObserver {
public:
static ContentViewCoreImpl* FromWebContents(WebContents* web_contents);
ContentViewCoreImpl(JNIEnv* env,
jobject obj,
- bool hardware_accelerated,
WebContents* web_contents,
ui::ViewAndroid* view_android,
- ui::WindowAndroid* window_android);
+ ui::WindowAndroid* window_android,
+ jobject java_bridge_retained_object_set);
// ContentViewCore implementation.
virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE;
@@ -54,16 +51,21 @@ class ContentViewCoreImpl : public ContentViewCore,
virtual ui::WindowAndroid* GetWindowAndroid() const OVERRIDE;
virtual scoped_refptr<cc::Layer> GetLayer() const OVERRIDE;
virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE;
- virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) OVERRIDE;
virtual void ShowPastePopup(int x, int y) OVERRIDE;
- virtual unsigned int GetScaledContentTexture(
+ virtual void GetScaledContentBitmap(
float scale,
- gfx::Size* out_size) OVERRIDE;
+ jobject bitmap_config,
+ gfx::Rect src_subrect,
+ const base::Callback<void(bool, const SkBitmap&)>& result_callback)
+ OVERRIDE;
virtual float GetDpiScale() const OVERRIDE;
- virtual void RequestContentClipping(const gfx::Rect& clipping,
- const gfx::Size& content_size) OVERRIDE;
virtual void PauseVideo() OVERRIDE;
virtual void PauseOrResumeGeolocation(bool should_pause) OVERRIDE;
+ virtual void RequestTextSurroundingSelection(
+ int max_length,
+ const base::Callback<void(const base::string16& content,
+ int start_offset,
+ int end_offset)>& callback) OVERRIDE;
// --------------------------------------------------------------------------
// Methods called from Java via JNI
@@ -83,22 +85,36 @@ class ContentViewCoreImpl : public ContentViewCore,
jstring url,
jint load_url_type,
jint transition_type,
+ jstring j_referrer_url,
+ jint referrer_policy,
jint ua_override_option,
jstring extra_headers,
jbyteArray post_data,
jstring base_url_for_data_url,
jstring virtual_url_for_data_url,
- jboolean can_load_local_resources);
+ jboolean can_load_local_resources,
+ jboolean is_renderer_initiated);
base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const;
- base::android::ScopedJavaLocalRef<jstring> GetTitle(
- JNIEnv* env, jobject obj) const;
jboolean IsIncognito(JNIEnv* env, jobject obj);
void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation);
- jboolean SendTouchEvent(JNIEnv* env,
- jobject obj,
- jlong time_ms,
- jint type,
- jobjectArray pts);
+ jboolean OnTouchEvent(JNIEnv* env,
+ jobject obj,
+ jobject motion_event,
+ jlong time_ms,
+ jint android_action,
+ jint pointer_count,
+ jint history_size,
+ jint action_index,
+ jfloat pos_x_0,
+ jfloat pos_y_0,
+ jfloat pos_x_1,
+ jfloat pos_y_1,
+ jint pointer_id_0,
+ jint pointer_id_1,
+ jfloat touch_major_0,
+ jfloat touch_major_1,
+ jfloat raw_pos_x,
+ jfloat raw_pos_y);
jboolean SendMouseMoveEvent(JNIEnv* env,
jobject obj,
jlong time_ms,
@@ -110,7 +126,8 @@ class ContentViewCoreImpl : public ContentViewCore,
jfloat x,
jfloat y,
jfloat vertical_axis);
- void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms, jfloat x, jfloat y);
+ void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms,
+ jfloat x, jfloat y, jfloat hintx, jfloat hinty);
void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms);
void ScrollBy(JNIEnv* env, jobject obj, jlong time_ms,
jfloat x, jfloat y, jfloat dx, jfloat dy);
@@ -118,24 +135,11 @@ class ContentViewCoreImpl : public ContentViewCore,
jfloat x, jfloat y, jfloat vx, jfloat vy);
void FlingCancel(JNIEnv* env, jobject obj, jlong time_ms);
void SingleTap(JNIEnv* env, jobject obj, jlong time_ms,
- jfloat x, jfloat y,
- jboolean disambiguation_popup_tap);
- void SingleTapUnconfirmed(JNIEnv* env, jobject obj, jlong time_ms,
- jfloat x, jfloat y);
- void ShowPressState(JNIEnv* env, jobject obj, jlong time_ms,
- jfloat x, jfloat y);
- void TapCancel(JNIEnv* env, jobject obj, jlong time_ms,
jfloat x, jfloat y);
- void TapDown(JNIEnv* env, jobject obj, jlong time_ms,
- jfloat x, jfloat y);
void DoubleTap(JNIEnv* env, jobject obj, jlong time_ms,
jfloat x, jfloat y) ;
void LongPress(JNIEnv* env, jobject obj, jlong time_ms,
- jfloat x, jfloat y,
- jboolean disambiguation_popup_tap);
- void LongTap(JNIEnv* env, jobject obj, jlong time_ms,
- jfloat x, jfloat y,
- jboolean disambiguation_popup_tap);
+ jfloat x, jfloat y);
void PinchBegin(JNIEnv* env, jobject obj, jlong time_ms, jfloat x, jfloat y);
void PinchEnd(JNIEnv* env, jobject obj, jlong time_ms);
void PinchBy(JNIEnv* env, jobject obj, jlong time_ms,
@@ -145,23 +149,29 @@ class ContentViewCoreImpl : public ContentViewCore,
jfloat x2, jfloat y2);
void MoveCaret(JNIEnv* env, jobject obj, jfloat x, jfloat y);
+ void ResetGestureDetection(JNIEnv* env, jobject obj);
+ void SetDoubleTapSupportEnabled(JNIEnv* env, jobject obj, jboolean enabled);
+ void SetMultiTouchZoomSupportEnabled(JNIEnv* env,
+ jobject obj,
+ jboolean enabled);
+
void LoadIfNecessary(JNIEnv* env, jobject obj);
void RequestRestoreLoad(JNIEnv* env, jobject obj);
- void StopLoading(JNIEnv* env, jobject obj);
void Reload(JNIEnv* env, jobject obj, jboolean check_for_repost);
void ReloadIgnoringCache(JNIEnv* env, jobject obj, jboolean check_for_repost);
void CancelPendingReload(JNIEnv* env, jobject obj);
void ContinuePendingReload(JNIEnv* env, jobject obj);
+ void AddStyleSheetByURL(JNIEnv* env, jobject obj, jstring url);
void ClearHistory(JNIEnv* env, jobject obj);
void EvaluateJavaScript(JNIEnv* env,
jobject obj,
jstring script,
jobject callback,
jboolean start_renderer);
- int GetNativeImeAdapter(JNIEnv* env, jobject obj);
+ long GetNativeImeAdapter(JNIEnv* env, jobject obj);
void SetFocus(JNIEnv* env, jobject obj, jboolean focused);
void ScrollFocusedEditableNodeIntoView(JNIEnv* env, jobject obj);
- void UndoScrollFocusedEditableNodeIntoView(JNIEnv* env, jobject obj);
+ void SelectWordAroundCaret(JNIEnv* env, jobject obj);
jint GetBackgroundColor(JNIEnv* env, jobject obj);
void SetBackgroundColor(JNIEnv* env, jobject obj, jint color);
@@ -175,12 +185,14 @@ class ContentViewCoreImpl : public ContentViewCore,
bool GetUseDesktopUserAgent(JNIEnv* env, jobject /* obj */);
void Show();
void Hide();
+ void SetAllowJavascriptInterfacesInspection(JNIEnv* env,
+ jobject obj,
+ jboolean allow);
void AddJavascriptInterface(JNIEnv* env,
jobject obj,
jobject object,
jstring name,
- jclass safe_annotation_clazz,
- jobject retained_object_set);
+ jclass safe_annotation_clazz);
void RemoveJavascriptInterface(JNIEnv* env, jobject obj, jstring name);
int GetNavigationHistory(JNIEnv* env, jobject obj, jobject history);
void GetDirectedNavigationHistory(JNIEnv* env,
@@ -190,13 +202,6 @@ class ContentViewCoreImpl : public ContentViewCore,
jint max_entries);
base::android::ScopedJavaLocalRef<jstring>
GetOriginalUrlForActiveNavigationEntry(JNIEnv* env, jobject obj);
- void UpdateVSyncParameters(JNIEnv* env, jobject obj, jlong timebase_micros,
- jlong interval_micros);
- void OnVSync(JNIEnv* env, jobject /* obj */, jlong frame_time_micros);
- jboolean OnAnimate(JNIEnv* env, jobject /* obj */, jlong frame_time_micros);
- jboolean PopulateBitmapFromCompositor(JNIEnv* env,
- jobject obj,
- jobject jbitmap);
void WasResized(JNIEnv* env, jobject obj);
jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj);
void ExitFullscreen(JNIEnv* env, jobject obj);
@@ -210,21 +215,10 @@ class ContentViewCoreImpl : public ContentViewCore,
void ShowInterstitialPage(JNIEnv* env,
jobject obj,
jstring jurl,
- jint delegate);
+ jlong delegate);
jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj);
- void AttachExternalVideoSurface(JNIEnv* env,
- jobject obj,
- jint player_id,
- jobject jsurface);
- void DetachExternalVideoSurface(JNIEnv* env, jobject obj, jint player_id);
void SetAccessibilityEnabled(JNIEnv* env, jobject obj, bool enabled);
- void SendActionAfterDoubleTapUma(JNIEnv* env,
- jobject obj,
- jint type,
- jboolean has_delay,
- jint count);
- void SendSingleTapUma(JNIEnv* env, jobject obj, jint type, jint count);
void ExtractSmartClipData(JNIEnv* env,
jobject obj,
@@ -232,21 +226,27 @@ class ContentViewCoreImpl : public ContentViewCore,
jint y,
jint width,
jint height);
+
+ void SetBackgroundOpaque(JNIEnv* env, jobject jobj, jboolean opaque);
+
+ jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj);
+
// --------------------------------------------------------------------------
// Public methods that call to Java via JNI
// --------------------------------------------------------------------------
- void OnSmartClipDataExtracted(const string16& result);
+ void OnSmartClipDataExtracted(const base::string16& result);
// Creates a popup menu with |items|.
// |multiple| defines if it should support multi-select.
// If not |multiple|, |selected_item| sets the initially selected item.
// Otherwise, item's "checked" flag selects it.
- void ShowSelectPopupMenu(const std::vector<MenuItem>& items,
+ void ShowSelectPopupMenu(const gfx::Rect& bounds,
+ const std::vector<MenuItem>& items,
int selected_item,
bool multiple);
-
- void OnTabCrashed();
+ // Hides a visible popup menu.
+ void HideSelectPopupMenu();
// All sizes and offsets are in CSS pixels as cached by the renderer.
void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset,
@@ -258,19 +258,18 @@ class ContentViewCoreImpl : public ContentViewCore,
const gfx::Vector2dF& content_offset,
float overdraw_bottom_height);
- void UpdateImeAdapter(int native_ime_adapter, int text_input_type,
+ void UpdateImeAdapter(long native_ime_adapter, int text_input_type,
const std::string& text,
int selection_start, int selection_end,
int composition_start, int composition_end,
- bool show_ime_if_needed, bool require_ack);
+ bool show_ime_if_needed, bool is_non_ime_change);
void SetTitle(const base::string16& title);
void OnBackgroundColorChanged(SkColor color);
bool HasFocus();
- void ConfirmTouchEvent(InputEventAckState ack_result);
- void UnhandledFlingStartEvent();
- void OnScrollUpdateGestureConsumed();
- void HasTouchEventHandlers(bool need_touch_events);
+ void OnGestureEventAck(const blink::WebGestureEvent& event,
+ InputEventAckState ack_result);
+ bool FilterInputEvent(const blink::WebInputEvent& event);
void OnSelectionChanged(const std::string& text);
void OnSelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params);
@@ -287,11 +286,6 @@ class ContentViewCoreImpl : public ContentViewCore,
// testing/benchmarking purposes
base::android::ScopedJavaLocalRef<jobject> CreateTouchEventSynthesizer();
- // Notifies the java object about the external surface, requesting for one if
- // necessary.
- void NotifyExternalSurface(
- int player_id, bool is_request, const gfx::RectF& rect);
-
base::android::ScopedJavaLocalRef<jobject> GetContentVideoViewClient();
// Returns the context that the ContentViewCore was created with, it would
@@ -301,6 +295,13 @@ class ContentViewCoreImpl : public ContentViewCore,
// Returns True if the given media should be blocked to load.
bool ShouldBlockMediaRequest(const GURL& url);
+ void DidStopFlinging();
+
+ // Returns the viewport size after accounting for the viewport offset.
+ gfx::Size GetViewSize() const;
+
+ void SetAccessibilityEnabledInternal(bool enabled);
+
// --------------------------------------------------------------------------
// Methods called from native code
// --------------------------------------------------------------------------
@@ -312,9 +313,6 @@ class ContentViewCoreImpl : public ContentViewCore,
void AttachLayer(scoped_refptr<cc::Layer> layer);
void RemoveLayer(scoped_refptr<cc::Layer> layer);
- void AddBeginFrameSubscriber();
- void RemoveBeginFrameSubscriber();
- void SetNeedsAnimate();
private:
class ContentViewUserData;
@@ -322,14 +320,11 @@ class ContentViewCoreImpl : public ContentViewCore,
friend class ContentViewUserData;
virtual ~ContentViewCoreImpl();
- // NotificationObserver implementation.
- virtual void Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details) OVERRIDE;
-
// WebContentsObserver implementation.
virtual void RenderViewReady() OVERRIDE;
- virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
+ virtual void RenderViewHostChanged(RenderViewHost* old_host,
+ RenderViewHost* new_host) OVERRIDE;
+ virtual void WebContentsDestroyed() OVERRIDE;
// --------------------------------------------------------------------------
// Other private methods and data
@@ -339,18 +334,15 @@ class ContentViewCoreImpl : public ContentViewCore,
RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid();
- float GetTouchPaddingDip();
-
blink::WebGestureEvent MakeGestureEvent(
blink::WebInputEvent::Type type, int64 time_ms, float x, float y) const;
- void SendBeginFrame(base::TimeTicks frame_time);
-
gfx::Size GetViewportSizePix() const;
gfx::Size GetViewportSizeOffsetPix() const;
void DeleteScaledSnapshotTexture();
+ bool OnMotionEvent(const ui::MotionEvent& event);
void SendGestureEvent(const blink::WebGestureEvent& event);
// Update focus state of the RenderWidgetHostView.
@@ -359,11 +351,11 @@ class ContentViewCoreImpl : public ContentViewCore,
// Send device_orientation_ to renderer.
void SendOrientationChangeEventInternal();
+ float dpi_scale() const { return dpi_scale_; }
+
// A weak reference to the Java ContentViewCore object.
JavaObjectWeakGlobalRef java_ref_;
- NotificationRegistrar notification_registrar_;
-
// Reference to the current WebContents used to determine how and what to
// display in the ContentViewCore.
WebContentsImpl* web_contents_;
@@ -374,10 +366,6 @@ class ContentViewCoreImpl : public ContentViewCore,
// Device scale factor.
float dpi_scale_;
- // Variables used to keep track of frame timestamps and deadlines.
- base::TimeDelta vsync_interval_;
- base::TimeDelta expected_browser_composite_time_;
-
// The Android view that can be used to add and remove decoration layers
// like AutofillPopup.
ui::ViewAndroid* view_android_;
@@ -389,7 +377,11 @@ class ContentViewCoreImpl : public ContentViewCore,
// will be sent to Renderer once it is ready.
int device_orientation_;
- bool geolocation_needs_pause_;
+ bool accessibility_enabled_;
+
+ // Manages injecting Java objects.
+ scoped_ptr<JavaBridgeDispatcherHostManager>
+ java_bridge_dispatcher_host_manager_;
DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl);
};