OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/resizing_mode_selector.h" | 5 #include "content/renderer/resizing_mode_selector.h" |
6 | 6 |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/renderer/render_thread_impl.h" | 8 #include "content/renderer/render_thread_impl.h" |
9 #include "content/renderer/render_widget.h" | 9 #include "content/renderer/render_widget.h" |
10 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | |
11 | 10 |
12 namespace content { | 11 namespace content { |
13 | 12 |
14 ResizingModeSelector::ResizingModeSelector() : is_synchronous_mode_(false) {} | 13 ResizingModeSelector::ResizingModeSelector() : is_synchronous_mode_(false) {} |
15 | 14 |
16 bool ResizingModeSelector::NeverUsesSynchronousResize() const { | 15 bool ResizingModeSelector::NeverUsesSynchronousResize() const { |
17 return !RenderThreadImpl::current() || // can be NULL when in unit tests | 16 return !RenderThreadImpl::current() || // can be NULL when in unit tests |
18 !RenderThreadImpl::current()->layout_test_mode(); | 17 !RenderThreadImpl::current()->layout_test_mode(); |
19 } | 18 } |
20 | 19 |
21 bool ResizingModeSelector::ShouldAbortOnResize(RenderWidget* widget, | 20 bool ResizingModeSelector::ShouldAbortOnResize(RenderWidget* widget, |
22 const ResizeParams& params) { | 21 const ResizeParams& params) { |
23 return is_synchronous_mode_ && | 22 return is_synchronous_mode_ && |
24 params.is_fullscreen_granted == widget->is_fullscreen_granted() && | 23 params.is_fullscreen_granted == widget->is_fullscreen_granted() && |
25 params.display_mode == widget->display_mode() && | 24 params.display_mode == widget->display_mode() && |
26 params.screen_info.deviceScaleFactor == | 25 params.screen_info.device_scale_factor == |
27 widget->screenInfo().deviceScaleFactor; | 26 widget->screenInfo().deviceScaleFactor; |
28 } | 27 } |
29 | 28 |
30 void ResizingModeSelector::set_is_synchronous_mode(bool mode) { | 29 void ResizingModeSelector::set_is_synchronous_mode(bool mode) { |
31 is_synchronous_mode_ = mode; | 30 is_synchronous_mode_ = mode; |
32 } | 31 } |
33 | 32 |
34 bool ResizingModeSelector::is_synchronous_mode() const { | 33 bool ResizingModeSelector::is_synchronous_mode() const { |
35 return is_synchronous_mode_; | 34 return is_synchronous_mode_; |
36 } | 35 } |
37 | 36 |
38 } // namespace content | 37 } // namespace content |
OLD | NEW |