Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / renderer / resizing_mode_selector.cc
blob58b4af1c02acd7012248a513954a494992cd8e64
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/platform/WebScreenInfo.h"
12 namespace content {
14 ResizingModeSelector::ResizingModeSelector() : is_synchronous_mode_(false) {}
16 bool ResizingModeSelector::NeverUsesSynchronousResize() const {
17 return !RenderThreadImpl::current() || // can be NULL when in unit tests
18 !RenderThreadImpl::current()->layout_test_mode();
21 bool ResizingModeSelector::ShouldAbortOnResize(
22 RenderWidget* widget,
23 const ViewMsg_Resize_Params& params) {
24 return is_synchronous_mode_ &&
25 params.is_fullscreen_granted == widget->is_fullscreen_granted() &&
26 params.display_mode == widget->display_mode() &&
27 params.screen_info.deviceScaleFactor ==
28 widget->screenInfo().deviceScaleFactor;
31 void ResizingModeSelector::set_is_synchronous_mode(bool mode) {
32 is_synchronous_mode_ = mode;
35 bool ResizingModeSelector::is_synchronous_mode() const {
36 return is_synchronous_mode_;
39 } // namespace content