| OLD | NEW |
| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 void RenderWidgetHostViewAndroid::WasResized() { | 379 void RenderWidgetHostViewAndroid::WasResized() { |
| 380 if (delegated_frame_host_ && content_view_core_) | 380 if (delegated_frame_host_ && content_view_core_) |
| 381 delegated_frame_host_->UpdateContainerSizeinDIP( | 381 delegated_frame_host_->UpdateContainerSizeinDIP( |
| 382 content_view_core_->GetViewportSizeDip()); | 382 content_view_core_->GetViewportSizeDip()); |
| 383 host_->WasResized(); | 383 host_->WasResized(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { | 386 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { |
| 387 // Ignore the given size as only the Java code has the power to | 387 // Ignore the given size as only the Java code has the power to |
| 388 // resize the view on Android. | 388 // resize the view on Android. |
| 389 LOG(ERROR) << "bshe" |
| 390 << "====set size should set to ====" << size.ToString(); |
| 389 default_bounds_ = gfx::Rect(default_bounds_.origin(), size); | 391 default_bounds_ = gfx::Rect(default_bounds_.origin(), size); |
| 390 } | 392 } |
| 391 | 393 |
| 392 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { | 394 void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { |
| 395 LOG(ERROR) << "bshe" |
| 396 << "===Setbounds ====" << rect.ToString(); |
| 393 default_bounds_ = rect; | 397 default_bounds_ = rect; |
| 394 } | 398 } |
| 395 | 399 |
| 396 void RenderWidgetHostViewAndroid::GetScaledContentBitmap( | 400 void RenderWidgetHostViewAndroid::GetScaledContentBitmap( |
| 397 float scale, | 401 float scale, |
| 398 SkColorType preferred_color_type, | 402 SkColorType preferred_color_type, |
| 399 gfx::Rect src_subrect, | 403 gfx::Rect src_subrect, |
| 400 const ReadbackRequestCallback& result_callback) { | 404 const ReadbackRequestCallback& result_callback) { |
| 401 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) { | 405 if (!host_ || host_->is_hidden() || !IsSurfaceAvailableForCopy()) { |
| 402 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); | 406 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 UnlockCompositingSurface(); | 548 UnlockCompositingSurface(); |
| 545 } | 549 } |
| 546 RunAckCallbacks(); | 550 RunAckCallbacks(); |
| 547 } | 551 } |
| 548 | 552 |
| 549 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 553 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
| 550 if (!content_view_core_) | 554 if (!content_view_core_) |
| 551 return default_bounds_; | 555 return default_bounds_; |
| 552 | 556 |
| 553 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 557 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 554 switches::kEnableOSKOverscroll)) | 558 switches::kEnableOSKOverscroll)) { |
| 555 return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden()); | 559 return gfx::Rect(content_view_core_->GetViewSizeWithOSKHidden()); |
| 560 } |
| 556 | 561 |
| 562 LOG(ERROR) << "bshe" |
| 563 << "====get view bounds====" |
| 564 << gfx::Rect(content_view_core_->GetViewSize()).ToString(); |
| 557 return gfx::Rect(content_view_core_->GetViewSize()); | 565 return gfx::Rect(content_view_core_->GetViewSize()); |
| 558 } | 566 } |
| 559 | 567 |
| 560 gfx::Size RenderWidgetHostViewAndroid::GetVisibleViewportSize() const { | 568 gfx::Size RenderWidgetHostViewAndroid::GetVisibleViewportSize() const { |
| 561 if (!content_view_core_) | 569 if (!content_view_core_) |
| 562 return default_bounds_.size(); | 570 return default_bounds_.size(); |
| 563 | 571 |
| 564 return content_view_core_->GetViewSize(); | 572 return content_view_core_->GetViewSize(); |
| 565 } | 573 } |
| 566 | 574 |
| 567 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { | 575 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { |
| 576 // return gfx::Size(2560, 1440); |
| 577 LOG(ERROR) << " get physical backing size, return empty size? "; |
| 578 |
| 568 if (!content_view_core_) { | 579 if (!content_view_core_) { |
| 569 if (default_bounds_.IsEmpty()) return gfx::Size(); | 580 if (default_bounds_.IsEmpty()) return gfx::Size(); |
| 570 | 581 |
| 571 return gfx::Size(default_bounds_.right() | 582 return gfx::Size(default_bounds_.right() |
| 572 * ui::GetScaleFactorForNativeView(GetNativeView()), | 583 * ui::GetScaleFactorForNativeView(GetNativeView()), |
| 573 default_bounds_.bottom() | 584 default_bounds_.bottom() |
| 574 * ui::GetScaleFactorForNativeView(GetNativeView())); | 585 * ui::GetScaleFactorForNativeView(GetNativeView())); |
| 575 } | 586 } |
| 576 | 587 |
| 588 LOG(ERROR) << " get physical backing size, real size " |
| 589 << content_view_core_->GetPhysicalBackingSize().ToString(); |
| 577 return content_view_core_->GetPhysicalBackingSize(); | 590 return content_view_core_->GetPhysicalBackingSize(); |
| 578 } | 591 } |
| 579 | 592 |
| 580 bool RenderWidgetHostViewAndroid::DoTopControlsShrinkBlinkSize() const { | 593 bool RenderWidgetHostViewAndroid::DoTopControlsShrinkBlinkSize() const { |
| 581 // Whether or not Blink's viewport size should be shrunk by the height of the | 594 // Whether or not Blink's viewport size should be shrunk by the height of the |
| 582 // URL-bar. | 595 // URL-bar. |
| 583 return content_view_core_ && | 596 return content_view_core_ && |
| 584 content_view_core_->DoTopControlsShrinkBlinkSize(); | 597 content_view_core_->DoTopControlsShrinkBlinkSize(); |
| 585 } | 598 } |
| 586 | 599 |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 case ui::MotionEvent::ACTION_UP: | 1881 case ui::MotionEvent::ACTION_UP: |
| 1869 case ui::MotionEvent::ACTION_POINTER_UP: | 1882 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1870 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1883 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1871 delta.InMicroseconds(), 1, 1000000, 50); | 1884 delta.InMicroseconds(), 1, 1000000, 50); |
| 1872 default: | 1885 default: |
| 1873 return; | 1886 return; |
| 1874 } | 1887 } |
| 1875 } | 1888 } |
| 1876 | 1889 |
| 1877 } // namespace content | 1890 } // namespace content |
| OLD | NEW |