Chromium Code Reviews| 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_base.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" | 11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
| 12 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 13 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber .h" | 16 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber .h" |
| 17 #include "content/browser/renderer_host/text_input_manager.h" | 17 #include "content/browser/renderer_host/text_input_manager.h" |
| 18 #include "content/common/content_switches_internal.h" | 18 #include "content/common/content_switches_internal.h" |
| 19 #include "ui/base/layout.h" | |
| 19 #include "ui/display/display.h" | 20 #include "ui/display/display.h" |
| 20 #include "ui/display/screen.h" | 21 #include "ui/display/screen.h" |
| 21 #include "ui/gfx/geometry/point_conversions.h" | 22 #include "ui/gfx/geometry/point_conversions.h" |
| 22 #include "ui/gfx/geometry/size_conversions.h" | 23 #include "ui/gfx/geometry/size_conversions.h" |
| 23 #include "ui/gfx/geometry/size_f.h" | 24 #include "ui/gfx/geometry/size_f.h" |
| 25 #include "ui/gfx/view_util.h" | |
| 24 | 26 |
| 25 namespace content { | 27 namespace content { |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 // How many microseconds apart input events should be flushed. | 31 // How many microseconds apart input events should be flushed. |
| 30 const int kFlushInputRateInUs = 16666; | 32 const int kFlushInputRateInUs = 16666; |
| 31 | 33 |
| 32 } | 34 } |
| 33 | 35 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 void RenderWidgetHostViewBase::SetBackgroundColorToDefault() { | 99 void RenderWidgetHostViewBase::SetBackgroundColorToDefault() { |
| 98 SetBackgroundColor(SK_ColorWHITE); | 100 SetBackgroundColor(SK_ColorWHITE); |
| 99 } | 101 } |
| 100 | 102 |
| 101 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { | 103 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { |
| 102 return SkColorGetA(background_color_) == SK_AlphaOPAQUE; | 104 return SkColorGetA(background_color_) == SK_AlphaOPAQUE; |
| 103 } | 105 } |
| 104 | 106 |
| 105 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { | 107 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { |
| 106 display::Display display = | 108 display::Display display = |
| 107 display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView()); | 109 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 110 gfx::GetTopLevel(GetNativeView())); | |
| 111 | |
| 108 return gfx::ScaleToCeiledSize(GetRequestedRendererSize(), | 112 return gfx::ScaleToCeiledSize(GetRequestedRendererSize(), |
| 109 display.device_scale_factor()); | 113 display.device_scale_factor()); |
| 110 } | 114 } |
| 111 | 115 |
| 112 bool RenderWidgetHostViewBase::DoBrowserControlsShrinkBlinkSize() const { | 116 bool RenderWidgetHostViewBase::DoBrowserControlsShrinkBlinkSize() const { |
| 113 return false; | 117 return false; |
| 114 } | 118 } |
| 115 | 119 |
| 116 float RenderWidgetHostViewBase::GetTopControlsHeight() const { | 120 float RenderWidgetHostViewBase::GetTopControlsHeight() const { |
| 117 return 0.f; | 121 return 0.f; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 | 260 |
| 257 if (impl && impl->delegate()) | 261 if (impl && impl->delegate()) |
| 258 impl->delegate()->SendScreenRects(); | 262 impl->delegate()->SendScreenRects(); |
| 259 | 263 |
| 260 if (HasDisplayPropertyChanged(view) && impl) | 264 if (HasDisplayPropertyChanged(view) && impl) |
| 261 impl->NotifyScreenInfoChanged(); | 265 impl->NotifyScreenInfoChanged(); |
| 262 } | 266 } |
| 263 | 267 |
| 264 bool RenderWidgetHostViewBase::HasDisplayPropertyChanged(gfx::NativeView view) { | 268 bool RenderWidgetHostViewBase::HasDisplayPropertyChanged(gfx::NativeView view) { |
| 265 display::Display display = | 269 display::Display display = |
| 266 display::Screen::GetScreen()->GetDisplayNearestWindow(view); | 270 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 271 gfx::GetTopLevel(view)); | |
| 267 if (current_display_area_ == display.work_area() && | 272 if (current_display_area_ == display.work_area() && |
| 268 current_device_scale_factor_ == display.device_scale_factor() && | 273 current_device_scale_factor_ == display.device_scale_factor() && |
| 269 current_display_rotation_ == display.rotation()) { | 274 current_display_rotation_ == display.rotation()) { |
| 270 return false; | 275 return false; |
| 271 } | 276 } |
| 272 | 277 |
| 273 current_display_area_ = display.work_area(); | 278 current_display_area_ = display.work_area(); |
| 274 current_device_scale_factor_ = display.device_scale_factor(); | 279 current_device_scale_factor_ = display.device_scale_factor(); |
| 275 current_display_rotation_ = display.rotation(); | 280 current_display_rotation_ = display.rotation(); |
| 276 return true; | 281 return true; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 304 void RenderWidgetHostViewBase::EndFrameSubscription() { | 309 void RenderWidgetHostViewBase::EndFrameSubscription() { |
| 305 NOTREACHED(); | 310 NOTREACHED(); |
| 306 } | 311 } |
| 307 | 312 |
| 308 void RenderWidgetHostViewBase::FocusedNodeTouched( | 313 void RenderWidgetHostViewBase::FocusedNodeTouched( |
| 309 const gfx::Point& location_dips_screen, | 314 const gfx::Point& location_dips_screen, |
| 310 bool editable) { | 315 bool editable) { |
| 311 DVLOG(1) << "FocusedNodeTouched: " << editable; | 316 DVLOG(1) << "FocusedNodeTouched: " << editable; |
| 312 } | 317 } |
| 313 | 318 |
| 319 float RenderWidgetHostViewBase::GetScaleFactorForNativeView() const { | |
| 320 return ui::GetScaleFactorForNativeWindow(gfx::GetTopLevel(GetNativeView())); | |
|
tapted
2017/02/15 00:36:10
if callers still need the virtual method in RWHV,
Jinsuk Kim
2017/02/16 10:11:25
Thanks for the suggestion. Done as suggested. I th
| |
| 321 } | |
| 322 | |
| 314 uint32_t RenderWidgetHostViewBase::RendererFrameNumber() { | 323 uint32_t RenderWidgetHostViewBase::RendererFrameNumber() { |
| 315 return renderer_frame_number_; | 324 return renderer_frame_number_; |
| 316 } | 325 } |
| 317 | 326 |
| 318 void RenderWidgetHostViewBase::DidReceiveRendererFrame() { | 327 void RenderWidgetHostViewBase::DidReceiveRendererFrame() { |
| 319 ++renderer_frame_number_; | 328 ++renderer_frame_number_; |
| 320 } | 329 } |
| 321 | 330 |
| 322 void RenderWidgetHostViewBase::FlushInput() { | 331 void RenderWidgetHostViewBase::FlushInput() { |
| 323 RenderWidgetHostImpl* impl = NULL; | 332 RenderWidgetHostImpl* impl = NULL; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 | 510 |
| 502 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { | 511 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { |
| 503 return false; | 512 return false; |
| 504 } | 513 } |
| 505 | 514 |
| 506 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { | 515 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { |
| 507 return cc::SurfaceId(); | 516 return cc::SurfaceId(); |
| 508 } | 517 } |
| 509 | 518 |
| 510 } // namespace content | 519 } // namespace content |
| OLD | NEW |