| 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 "content/browser/accessibility/browser_accessibility_manager.h" | 8 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 9 #include "content/browser/gpu/gpu_data_manager_impl.h" | 9 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 namespace { | 360 namespace { |
| 361 | 361 |
| 362 // How many microseconds apart input events should be flushed. | 362 // How many microseconds apart input events should be flushed. |
| 363 const int kFlushInputRateInUs = 16666; | 363 const int kFlushInputRateInUs = 16666; |
| 364 | 364 |
| 365 } | 365 } |
| 366 | 366 |
| 367 RenderWidgetHostViewBase::RenderWidgetHostViewBase() | 367 RenderWidgetHostViewBase::RenderWidgetHostViewBase() |
| 368 : popup_type_(blink::WebPopupTypeNone), | 368 : popup_type_(blink::WebPopupTypeNone), |
| 369 background_opaque_(true), | 369 background_color_(SK_ColorWHITE), |
| 370 mouse_locked_(false), | 370 mouse_locked_(false), |
| 371 showing_context_menu_(false), | 371 showing_context_menu_(false), |
| 372 selection_text_offset_(0), | 372 selection_text_offset_(0), |
| 373 selection_range_(gfx::Range::InvalidRange()), | 373 selection_range_(gfx::Range::InvalidRange()), |
| 374 current_device_scale_factor_(0), | 374 current_device_scale_factor_(0), |
| 375 current_display_rotation_(gfx::Display::ROTATE_0), | 375 current_display_rotation_(gfx::Display::ROTATE_0), |
| 376 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), | 376 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), |
| 377 renderer_frame_number_(0), | 377 renderer_frame_number_(0), |
| 378 weak_factory_(this) { | 378 weak_factory_(this) { |
| 379 } | 379 } |
| 380 | 380 |
| 381 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { | 381 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { |
| 382 DCHECK(!mouse_locked_); | 382 DCHECK(!mouse_locked_); |
| 383 } | 383 } |
| 384 | 384 |
| 385 bool RenderWidgetHostViewBase::OnMessageReceived(const IPC::Message& msg){ | 385 bool RenderWidgetHostViewBase::OnMessageReceived(const IPC::Message& msg){ |
| 386 return false; | 386 return false; |
| 387 } | 387 } |
| 388 | 388 |
| 389 void RenderWidgetHostViewBase::SetBackgroundOpaque(bool opaque) { | 389 void RenderWidgetHostViewBase::SetBackgroundColor(SkColor color) { |
| 390 background_opaque_ = opaque; | 390 background_color_ = color; |
| 391 } |
| 392 |
| 393 void RenderWidgetHostViewBase::FillBackgroundWithDefaultColor() { |
| 394 SetBackgroundColor(SK_ColorWHITE); |
| 391 } | 395 } |
| 392 | 396 |
| 393 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { | 397 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { |
| 394 return background_opaque_; | 398 return SkColorGetA(background_color_) == SK_AlphaOPAQUE; |
| 395 } | 399 } |
| 396 | 400 |
| 397 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { | 401 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { |
| 398 gfx::NativeView view = GetNativeView(); | 402 gfx::NativeView view = GetNativeView(); |
| 399 gfx::Display display = | 403 gfx::Display display = |
| 400 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view); | 404 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view); |
| 401 return gfx::ToCeiledSize(gfx::ScaleSize(GetRequestedRendererSize(), | 405 return gfx::ToCeiledSize(gfx::ScaleSize(GetRequestedRendererSize(), |
| 402 display.device_scale_factor())); | 406 display.device_scale_factor())); |
| 403 } | 407 } |
| 404 | 408 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 ? blink::WebScreenOrientationPortraitPrimary | 685 ? blink::WebScreenOrientationPortraitPrimary |
| 682 : blink::WebScreenOrientationPortraitSecondary; | 686 : blink::WebScreenOrientationPortraitSecondary; |
| 683 } | 687 } |
| 684 | 688 |
| 685 return primary_landscape_angle == angle | 689 return primary_landscape_angle == angle |
| 686 ? blink::WebScreenOrientationLandscapePrimary | 690 ? blink::WebScreenOrientationLandscapePrimary |
| 687 : blink::WebScreenOrientationLandscapeSecondary; | 691 : blink::WebScreenOrientationLandscapeSecondary; |
| 688 } | 692 } |
| 689 | 693 |
| 690 } // namespace content | 694 } // namespace content |
| OLD | NEW |