1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/resizing_mode_selector.h"
7 #include "content/common/view_messages.h"
8 #include "content/renderer/render_thread_impl.h"
9 #include "content/renderer/render_widget.h"
10 #include "third_party/WebKit/public/web/WebScreenInfo.h"
14 ResizingModeSelector::ResizingModeSelector()
15 : is_synchronous_mode_(false) {
16 // TODO(dglazkov): Remove this re-initialization once the transition to
17 // useUnfortunateAsynchronousResizeMode is complete.
18 // See http://crbug.com/309760 for details.
19 is_synchronous_mode_
= RenderThreadImpl::current() &&
20 RenderThreadImpl::current()->layout_test_mode();
23 bool ResizingModeSelector::ShouldAbortOnResize(
25 const ViewMsg_Resize_Params
& params
) {
26 return is_synchronous_mode_
&&
27 params
.is_fullscreen
== widget
->is_fullscreen() &&
28 params
.screen_info
.deviceScaleFactor
==
29 widget
->screenInfo().deviceScaleFactor
;
32 void ResizingModeSelector::set_is_synchronous_mode(bool mode
) {
33 // TODO(dglazkov): Actually set is_synchronous_mode_ once the transition to
34 // useUnfortunateAsynchronousResizeMode is complete.
37 bool ResizingModeSelector::is_synchronous_mode() const {
38 return is_synchronous_mode_
;
41 } // namespace content