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_color_(SK_ColorWHITE), | 369 background_opaque_(true), |
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::SetBackgroundColor(SkColor color) { | 389 void RenderWidgetHostViewBase::SetBackgroundOpaque(bool opaque) { |
390 background_color_ = color; | 390 background_opaque_ = opaque; |
391 } | |
392 | |
393 void RenderWidgetHostViewBase::SetBackgroundColorToDefault() { | |
394 SetBackgroundColor(SK_ColorWHITE); | |
395 } | 391 } |
396 | 392 |
397 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { | 393 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { |
398 return SkColorGetA(background_color_) == SK_AlphaOPAQUE; | 394 return background_opaque_; |
399 } | 395 } |
400 | 396 |
401 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { | 397 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { |
402 gfx::NativeView view = GetNativeView(); | 398 gfx::NativeView view = GetNativeView(); |
403 gfx::Display display = | 399 gfx::Display display = |
404 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view); | 400 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view); |
405 return gfx::ToCeiledSize(gfx::ScaleSize(GetRequestedRendererSize(), | 401 return gfx::ToCeiledSize(gfx::ScaleSize(GetRequestedRendererSize(), |
406 display.device_scale_factor())); | 402 display.device_scale_factor())); |
407 } | 403 } |
408 | 404 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 ? blink::WebScreenOrientationPortraitPrimary | 681 ? blink::WebScreenOrientationPortraitPrimary |
686 : blink::WebScreenOrientationPortraitSecondary; | 682 : blink::WebScreenOrientationPortraitSecondary; |
687 } | 683 } |
688 | 684 |
689 return primary_landscape_angle == angle | 685 return primary_landscape_angle == angle |
690 ? blink::WebScreenOrientationLandscapePrimary | 686 ? blink::WebScreenOrientationLandscapePrimary |
691 : blink::WebScreenOrientationLandscapeSecondary; | 687 : blink::WebScreenOrientationLandscapeSecondary; |
692 } | 688 } |
693 | 689 |
694 } // namespace content | 690 } // namespace content |
OLD | NEW |