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

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

Issue 401863003: Merge 279991 "[Android] Select text when stylus first button is ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985_122/src/
Patch Set: Created 6 years, 5 months 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/android/sys_utils.h" 9 #include "base/android/sys_utils.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 is_showing_(!widget_host->is_hidden()), 179 is_showing_(!widget_host->is_hidden()),
180 content_view_core_(NULL), 180 content_view_core_(NULL),
181 ime_adapter_android_(this), 181 ime_adapter_android_(this),
182 cached_background_color_(SK_ColorWHITE), 182 cached_background_color_(SK_ColorWHITE),
183 last_output_surface_id_(kUndefinedOutputSurfaceId), 183 last_output_surface_id_(kUndefinedOutputSurfaceId),
184 weak_ptr_factory_(this), 184 weak_ptr_factory_(this),
185 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch( 185 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch(
186 switches::kDisableOverscrollEdgeEffect)), 186 switches::kDisableOverscrollEdgeEffect)),
187 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), 187 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)),
188 gesture_provider_(CreateGestureProviderConfig(), this), 188 gesture_provider_(CreateGestureProviderConfig(), this),
189 gesture_text_selector_(this),
189 flush_input_requested_(false), 190 flush_input_requested_(false),
190 accelerated_surface_route_id_(0), 191 accelerated_surface_route_id_(0),
191 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( 192 using_synchronous_compositor_(SynchronousCompositorImpl::FromID(
192 widget_host->GetProcess()->GetID(), 193 widget_host->GetProcess()->GetID(),
193 widget_host->GetRoutingID()) != NULL), 194 widget_host->GetRoutingID()) != NULL),
194 frame_evictor_(new DelegatedFrameEvictor(this)), 195 frame_evictor_(new DelegatedFrameEvictor(this)),
195 locks_on_frame_count_(0), 196 locks_on_frame_count_(0),
196 observing_root_window_(false) { 197 observing_root_window_(false) {
197 host_->SetView(this); 198 host_->SetView(this);
198 SetContentViewCore(content_view_core); 199 SetContentViewCore(content_view_core);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 } 565 }
565 566
566 bool RenderWidgetHostViewAndroid::OnTouchEvent( 567 bool RenderWidgetHostViewAndroid::OnTouchEvent(
567 const ui::MotionEvent& event) { 568 const ui::MotionEvent& event) {
568 if (!host_) 569 if (!host_)
569 return false; 570 return false;
570 571
571 if (!gesture_provider_.OnTouchEvent(event)) 572 if (!gesture_provider_.OnTouchEvent(event))
572 return false; 573 return false;
573 574
575 if (gesture_text_selector_.OnTouchEvent(event)) {
576 gesture_provider_.OnTouchEventAck(false);
577 return true;
578 }
579
574 // Short-circuit touch forwarding if no touch handlers exist. 580 // Short-circuit touch forwarding if no touch handlers exist.
575 if (!host_->ShouldForwardTouchEvent()) { 581 if (!host_->ShouldForwardTouchEvent()) {
576 const bool event_consumed = false; 582 const bool event_consumed = false;
577 gesture_provider_.OnTouchEventAck(event_consumed); 583 gesture_provider_.OnTouchEventAck(event_consumed);
578 return true; 584 return true;
579 } 585 }
580 586
581 SendTouchEvent(CreateWebTouchEventFromMotionEvent(event)); 587 SendTouchEvent(CreateWebTouchEventFromMotionEvent(event));
582 return true; 588 return true;
583 } 589 }
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1292
1287 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1293 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1288 while (!ack_callbacks_.empty()) { 1294 while (!ack_callbacks_.empty()) {
1289 ack_callbacks_.front().Run(); 1295 ack_callbacks_.front().Run();
1290 ack_callbacks_.pop(); 1296 ack_callbacks_.pop();
1291 } 1297 }
1292 } 1298 }
1293 1299
1294 void RenderWidgetHostViewAndroid::OnGestureEvent( 1300 void RenderWidgetHostViewAndroid::OnGestureEvent(
1295 const ui::GestureEventData& gesture) { 1301 const ui::GestureEventData& gesture) {
1302 if (gesture_text_selector_.OnGestureEvent(gesture))
1303 return;
1304
1296 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); 1305 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture));
1297 } 1306 }
1298 1307
1299 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { 1308 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() {
1300 RunAckCallbacks(); 1309 RunAckCallbacks();
1301 } 1310 }
1302 1311
1303 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1312 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1304 DCHECK(content_view_core_); 1313 DCHECK(content_view_core_);
1305 DCHECK(!using_synchronous_compositor_); 1314 DCHECK(!using_synchronous_compositor_);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 // Define the criteria here. If say the 16 texture readback is 1446 // Define the criteria here. If say the 16 texture readback is
1438 // supported we should go with that (this degrades quality) 1447 // supported we should go with that (this degrades quality)
1439 // or stick back to the default format. 1448 // or stick back to the default format.
1440 if (base::android::SysUtils::IsLowEndDevice()) { 1449 if (base::android::SysUtils::IsLowEndDevice()) {
1441 if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config)) 1450 if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config))
1442 return SkBitmap::kRGB_565_Config; 1451 return SkBitmap::kRGB_565_Config;
1443 } 1452 }
1444 return SkBitmap::kARGB_8888_Config; 1453 return SkBitmap::kARGB_8888_Config;
1445 } 1454 }
1446 1455
1456 void RenderWidgetHostViewAndroid::ShowSelectionHandlesAutomatically() {
1457 if (content_view_core_)
1458 content_view_core_->ShowSelectionHandlesAutomatically();
1459 }
1460
1461 void RenderWidgetHostViewAndroid::SelectRange(
1462 float x1, float y1, float x2, float y2) {
1463 if (content_view_core_)
1464 static_cast<WebContentsImpl*>(content_view_core_->GetWebContents())->
1465 SelectRange(gfx::Point(x1, y1), gfx::Point(x2, y2));
1466 }
1467
1468 void RenderWidgetHostViewAndroid::Unselect() {
1469 if (content_view_core_)
1470 content_view_core_->GetWebContents()->Unselect();
1471 }
1472
1447 // static 1473 // static
1448 void RenderWidgetHostViewBase::GetDefaultScreenInfo( 1474 void RenderWidgetHostViewBase::GetDefaultScreenInfo(
1449 blink::WebScreenInfo* results) { 1475 blink::WebScreenInfo* results) {
1450 const gfx::Display& display = 1476 const gfx::Display& display =
1451 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 1477 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
1452 results->rect = display.bounds(); 1478 results->rect = display.bounds();
1453 // TODO(husky): Remove any system controls from availableRect. 1479 // TODO(husky): Remove any system controls from availableRect.
1454 results->availableRect = display.work_area(); 1480 results->availableRect = display.work_area();
1455 results->deviceScaleFactor = display.device_scale_factor(); 1481 results->deviceScaleFactor = display.device_scale_factor();
1456 results->orientationAngle = display.RotationAsDegree(); 1482 results->orientationAngle = display.RotationAsDegree();
1457 gfx::DeviceDisplayInfo info; 1483 gfx::DeviceDisplayInfo info;
1458 results->depth = info.GetBitsPerPixel(); 1484 results->depth = info.GetBitsPerPixel();
1459 results->depthPerComponent = info.GetBitsPerComponent(); 1485 results->depthPerComponent = info.GetBitsPerComponent();
1460 results->isMonochrome = (results->depthPerComponent == 0); 1486 results->isMonochrome = (results->depthPerComponent == 0);
1461 } 1487 }
1462 1488
1463 } // namespace content 1489 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698