| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 scale_ = params_.scale; | 371 scale_ = params_.scale; |
| 372 offset_.SetPoint(params_.offset.x, params_.offset.y); | 372 offset_.SetPoint(params_.offset.x, params_.offset.y); |
| 373 } | 373 } |
| 374 | 374 |
| 375 if (params_.screenPosition == WebDeviceEmulationParams::Desktop) { | 375 if (params_.screenPosition == WebDeviceEmulationParams::Desktop) { |
| 376 applied_widget_rect_.set_origin(original_view_screen_rect_.origin()); | 376 applied_widget_rect_.set_origin(original_view_screen_rect_.origin()); |
| 377 widget_->screen_info_.rect = original_screen_info_.rect; | 377 widget_->screen_info_.rect = original_screen_info_.rect; |
| 378 widget_->screen_info_.availableRect = original_screen_info_.availableRect; | 378 widget_->screen_info_.availableRect = original_screen_info_.availableRect; |
| 379 widget_->window_screen_rect_ = original_window_screen_rect_; | 379 widget_->window_screen_rect_ = original_window_screen_rect_; |
| 380 } else { | 380 } else { |
| 381 applied_widget_rect_.set_origin(gfx::Point(0, 0)); | 381 applied_widget_rect_.set_origin(params_.viewPosition); |
| 382 widget_->screen_info_.rect = applied_widget_rect_; | 382 gfx::Rect screen_rect = applied_widget_rect_; |
| 383 widget_->screen_info_.availableRect = applied_widget_rect_; | 383 if (!params_.screenSize.isEmpty()) { |
| 384 screen_rect = |
| 385 gfx::Rect(0, 0, params_.screenSize.width, params_.screenSize.height); |
| 386 } |
| 387 widget_->screen_info_.rect = screen_rect; |
| 388 widget_->screen_info_.availableRect = screen_rect; |
| 384 widget_->window_screen_rect_ = applied_widget_rect_; | 389 widget_->window_screen_rect_ = applied_widget_rect_; |
| 385 } | 390 } |
| 386 | 391 |
| 387 float applied_device_scale_factor = params_.deviceScaleFactor ? | 392 float applied_device_scale_factor = params_.deviceScaleFactor ? |
| 388 params_.deviceScaleFactor : original_screen_info_.deviceScaleFactor; | 393 params_.deviceScaleFactor : original_screen_info_.deviceScaleFactor; |
| 389 widget_->screen_info_.deviceScaleFactor = applied_device_scale_factor; | 394 widget_->screen_info_.deviceScaleFactor = applied_device_scale_factor; |
| 390 | 395 |
| 391 // Pass three emulation parameters to the blink side: | 396 // Pass three emulation parameters to the blink side: |
| 392 // - we keep the real device scale factor in compositor to produce sharp image | 397 // - we keep the real device scale factor in compositor to produce sharp image |
| 393 // even when emulating different scale factor; | 398 // even when emulating different scale factor; |
| (...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2450 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2455 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2451 video_hole_frames_.AddObserver(frame); | 2456 video_hole_frames_.AddObserver(frame); |
| 2452 } | 2457 } |
| 2453 | 2458 |
| 2454 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2459 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2455 video_hole_frames_.RemoveObserver(frame); | 2460 video_hole_frames_.RemoveObserver(frame); |
| 2456 } | 2461 } |
| 2457 #endif // defined(VIDEO_HOLE) | 2462 #endif // defined(VIDEO_HOLE) |
| 2458 | 2463 |
| 2459 } // namespace content | 2464 } // namespace content |
| OLD | NEW |