Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { 207 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) {
208 // Ignore the given size as only the Java code has the power to 208 // Ignore the given size as only the Java code has the power to
209 // resize the view on Android. 209 // resize the view on Android.
210 WasResized(); 210 WasResized();
211 } 211 }
212 212
213 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { 213 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) {
214 SetSize(rect.size()); 214 SetSize(rect.size());
215 } 215 }
216 216
217 WebKit::WebGLId RenderWidgetHostViewAndroid::GetScaledContentTexture( 217 blink::WebGLId RenderWidgetHostViewAndroid::GetScaledContentTexture(
218 float scale, 218 float scale,
219 gfx::Size* out_size) { 219 gfx::Size* out_size) {
220 gfx::Size size(gfx::ToCeiledSize( 220 gfx::Size size(gfx::ToCeiledSize(
221 gfx::ScaleSize(texture_size_in_layer_, scale))); 221 gfx::ScaleSize(texture_size_in_layer_, scale)));
222 222
223 if (!CompositorImpl::IsInitialized() || 223 if (!CompositorImpl::IsInitialized() ||
224 texture_id_in_layer_ == 0 || 224 texture_id_in_layer_ == 0 ||
225 texture_size_in_layer_.IsEmpty() || 225 texture_size_in_layer_.IsEmpty() ||
226 size.IsEmpty()) { 226 size.IsEmpty()) {
227 if (out_size) 227 if (out_size)
(...skipping 19 matching lines...) Expand all
247 texture_size_in_layer_.IsEmpty()) 247 texture_size_in_layer_.IsEmpty())
248 return false; 248 return false;
249 249
250 gfx::JavaBitmap bitmap(jbitmap); 250 gfx::JavaBitmap bitmap(jbitmap);
251 251
252 // TODO(dtrainor): Eventually add support for multiple formats here. 252 // TODO(dtrainor): Eventually add support for multiple formats here.
253 DCHECK(bitmap.format() == ANDROID_BITMAP_FORMAT_RGBA_8888); 253 DCHECK(bitmap.format() == ANDROID_BITMAP_FORMAT_RGBA_8888);
254 254
255 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); 255 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
256 256
257 WebKit::WebGLId texture = helper->CopyAndScaleTexture( 257 blink::WebGLId texture = helper->CopyAndScaleTexture(
258 texture_id_in_layer_, 258 texture_id_in_layer_,
259 texture_size_in_layer_, 259 texture_size_in_layer_,
260 bitmap.size(), 260 bitmap.size(),
261 true, 261 true,
262 GLHelper::SCALER_QUALITY_FAST); 262 GLHelper::SCALER_QUALITY_FAST);
263 if (texture == 0) 263 if (texture == 0)
264 return false; 264 return false;
265 265
266 helper->ReadbackTextureSync(texture, 266 helper->ReadbackTextureSync(texture,
267 gfx::Rect(bitmap.size()), 267 gfx::Rect(bitmap.size()),
268 static_cast<unsigned char*> (bitmap.pixels())); 268 static_cast<unsigned char*> (bitmap.pixels()));
269 269
270 WebKit::WebGraphicsContext3D* context = 270 blink::WebGraphicsContext3D* context =
271 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); 271 ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
272 context->deleteTexture(texture); 272 context->deleteTexture(texture);
273 273
274 return true; 274 return true;
275 } 275 }
276 276
277 bool RenderWidgetHostViewAndroid::HasValidFrame() const { 277 bool RenderWidgetHostViewAndroid::HasValidFrame() const {
278 if (!content_view_core_) 278 if (!content_view_core_)
279 return false; 279 return false;
280 if (texture_size_in_layer_.IsEmpty()) 280 if (texture_size_in_layer_.IsEmpty())
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 if (delegated_renderer_layer_.get()) 946 if (delegated_renderer_layer_.get())
947 DestroyDelegatedContent(); 947 DestroyDelegatedContent();
948 } 948 }
949 949
950 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( 950 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface(
951 const gfx::Size& desired_size) { 951 const gfx::Size& desired_size) {
952 NOTREACHED(); 952 NOTREACHED();
953 return false; 953 return false;
954 } 954 }
955 955
956 void RenderWidgetHostViewAndroid::GetScreenInfo(WebKit::WebScreenInfo* result) { 956 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) {
957 // ScreenInfo isn't tied to the widget on Android. Always return the default. 957 // ScreenInfo isn't tied to the widget on Android. Always return the default.
958 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); 958 RenderWidgetHostViewBase::GetDefaultScreenInfo(result);
959 } 959 }
960 960
961 // TODO(jrg): Find out the implications and answer correctly here, 961 // TODO(jrg): Find out the implications and answer correctly here,
962 // as we are returning the WebView and not root window bounds. 962 // as we are returning the WebView and not root window bounds.
963 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { 963 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() {
964 return GetViewBounds(); 964 return GetViewBounds();
965 } 965 }
966 966
(...skipping 11 matching lines...) Expand all
978 bool has_horizontal_scrollbar) { 978 bool has_horizontal_scrollbar) {
979 // intentionally empty, like RenderWidgetHostViewViews 979 // intentionally empty, like RenderWidgetHostViewViews
980 } 980 }
981 981
982 void RenderWidgetHostViewAndroid::SetScrollOffsetPinning( 982 void RenderWidgetHostViewAndroid::SetScrollOffsetPinning(
983 bool is_pinned_to_left, bool is_pinned_to_right) { 983 bool is_pinned_to_left, bool is_pinned_to_right) {
984 // intentionally empty, like RenderWidgetHostViewViews 984 // intentionally empty, like RenderWidgetHostViewViews
985 } 985 }
986 986
987 void RenderWidgetHostViewAndroid::UnhandledWheelEvent( 987 void RenderWidgetHostViewAndroid::UnhandledWheelEvent(
988 const WebKit::WebMouseWheelEvent& event) { 988 const blink::WebMouseWheelEvent& event) {
989 // intentionally empty, like RenderWidgetHostViewViews 989 // intentionally empty, like RenderWidgetHostViewViews
990 } 990 }
991 991
992 void RenderWidgetHostViewAndroid::GestureEventAck( 992 void RenderWidgetHostViewAndroid::GestureEventAck(
993 int gesture_event_type, 993 int gesture_event_type,
994 InputEventAckState ack_result) { 994 InputEventAckState ack_result) {
995 if (gesture_event_type == WebKit::WebInputEvent::GestureScrollUpdate && 995 if (gesture_event_type == blink::WebInputEvent::GestureScrollUpdate &&
996 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { 996 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) {
997 content_view_core_->OnScrollUpdateGestureConsumed(); 997 content_view_core_->OnScrollUpdateGestureConsumed();
998 } 998 }
999 if (gesture_event_type == WebKit::WebInputEvent::GestureFlingStart && 999 if (gesture_event_type == blink::WebInputEvent::GestureFlingStart &&
1000 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { 1000 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) {
1001 content_view_core_->UnhandledFlingStartEvent(); 1001 content_view_core_->UnhandledFlingStartEvent();
1002 } 1002 }
1003 } 1003 }
1004 1004
1005 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( 1005 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent(
1006 const WebKit::WebInputEvent& input_event) { 1006 const blink::WebInputEvent& input_event) {
1007 if (host_) { 1007 if (host_) {
1008 SynchronousCompositorImpl* compositor = 1008 SynchronousCompositorImpl* compositor =
1009 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), 1009 SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(),
1010 host_->GetRoutingID()); 1010 host_->GetRoutingID());
1011 if (compositor) 1011 if (compositor)
1012 return compositor->HandleInputEvent(input_event); 1012 return compositor->HandleInputEvent(input_event);
1013 } 1013 }
1014 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 1014 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1015 } 1015 }
1016 1016
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1101
1102 // Methods called from the host to the render 1102 // Methods called from the host to the render
1103 1103
1104 void RenderWidgetHostViewAndroid::SendKeyEvent( 1104 void RenderWidgetHostViewAndroid::SendKeyEvent(
1105 const NativeWebKeyboardEvent& event) { 1105 const NativeWebKeyboardEvent& event) {
1106 if (host_) 1106 if (host_)
1107 host_->ForwardKeyboardEvent(event); 1107 host_->ForwardKeyboardEvent(event);
1108 } 1108 }
1109 1109
1110 void RenderWidgetHostViewAndroid::SendTouchEvent( 1110 void RenderWidgetHostViewAndroid::SendTouchEvent(
1111 const WebKit::WebTouchEvent& event) { 1111 const blink::WebTouchEvent& event) {
1112 if (host_) 1112 if (host_)
1113 host_->ForwardTouchEventWithLatencyInfo(event, ui::LatencyInfo()); 1113 host_->ForwardTouchEventWithLatencyInfo(event, ui::LatencyInfo());
1114 } 1114 }
1115 1115
1116 1116
1117 void RenderWidgetHostViewAndroid::SendMouseEvent( 1117 void RenderWidgetHostViewAndroid::SendMouseEvent(
1118 const WebKit::WebMouseEvent& event) { 1118 const blink::WebMouseEvent& event) {
1119 if (host_) 1119 if (host_)
1120 host_->ForwardMouseEvent(event); 1120 host_->ForwardMouseEvent(event);
1121 } 1121 }
1122 1122
1123 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1123 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1124 const WebKit::WebMouseWheelEvent& event) { 1124 const blink::WebMouseWheelEvent& event) {
1125 if (host_) 1125 if (host_)
1126 host_->ForwardWheelEvent(event); 1126 host_->ForwardWheelEvent(event);
1127 } 1127 }
1128 1128
1129 void RenderWidgetHostViewAndroid::SendGestureEvent( 1129 void RenderWidgetHostViewAndroid::SendGestureEvent(
1130 const WebKit::WebGestureEvent& event) { 1130 const blink::WebGestureEvent& event) {
1131 // Sending a gesture that may trigger overscroll should resume the effect. 1131 // Sending a gesture that may trigger overscroll should resume the effect.
1132 if (overscroll_effect_) 1132 if (overscroll_effect_)
1133 overscroll_effect_->SetEnabled(true); 1133 overscroll_effect_->SetEnabled(true);
1134 1134
1135 if (host_) 1135 if (host_)
1136 host_->ForwardGestureEvent(event); 1136 host_->ForwardGestureEvent(event);
1137 } 1137 }
1138 1138
1139 void RenderWidgetHostViewAndroid::SelectRange(const gfx::Point& start, 1139 void RenderWidgetHostViewAndroid::SelectRange(const gfx::Point& start,
1140 const gfx::Point& end) { 1140 const gfx::Point& end) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 1338
1339 DCHECK_EQ(source->width(), dst_size_in_pixel.width()); 1339 DCHECK_EQ(source->width(), dst_size_in_pixel.width());
1340 DCHECK_EQ(source->height(), dst_size_in_pixel.height()); 1340 DCHECK_EQ(source->height(), dst_size_in_pixel.height());
1341 1341
1342 ignore_result(scoped_callback_runner.Release()); 1342 ignore_result(scoped_callback_runner.Release());
1343 callback.Run(true, *source); 1343 callback.Run(true, *source);
1344 } 1344 }
1345 1345
1346 // static 1346 // static
1347 void RenderWidgetHostViewPort::GetDefaultScreenInfo( 1347 void RenderWidgetHostViewPort::GetDefaultScreenInfo(
1348 WebKit::WebScreenInfo* results) { 1348 blink::WebScreenInfo* results) {
1349 const gfx::Display& display = 1349 const gfx::Display& display =
1350 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 1350 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
1351 results->rect = display.bounds(); 1351 results->rect = display.bounds();
1352 // TODO(husky): Remove any system controls from availableRect. 1352 // TODO(husky): Remove any system controls from availableRect.
1353 results->availableRect = display.work_area(); 1353 results->availableRect = display.work_area();
1354 results->deviceScaleFactor = display.device_scale_factor(); 1354 results->deviceScaleFactor = display.device_scale_factor();
1355 gfx::DeviceDisplayInfo info; 1355 gfx::DeviceDisplayInfo info;
1356 results->depth = info.GetBitsPerPixel(); 1356 results->depth = info.GetBitsPerPixel();
1357 results->depthPerComponent = info.GetBitsPerComponent(); 1357 results->depthPerComponent = info.GetBitsPerComponent();
1358 results->isMonochrome = (results->depthPerComponent == 0); 1358 results->isMonochrome = (results->depthPerComponent == 0);
1359 } 1359 }
1360 1360
1361 //////////////////////////////////////////////////////////////////////////////// 1361 ////////////////////////////////////////////////////////////////////////////////
1362 // RenderWidgetHostView, public: 1362 // RenderWidgetHostView, public:
1363 1363
1364 // static 1364 // static
1365 RenderWidgetHostView* 1365 RenderWidgetHostView*
1366 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 1366 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
1367 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 1367 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
1368 return new RenderWidgetHostViewAndroid(rwhi, NULL); 1368 return new RenderWidgetHostViewAndroid(rwhi, NULL);
1369 } 1369 }
1370 1370
1371 } // namespace content 1371 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698