Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / resizing_mode_selector.h
blobac657e294cde8ffd18364aee822cc93de1142be0
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 #ifndef CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_
6 #define CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_
8 #include "base/basictypes.h"
10 struct ViewMsg_Resize_Params;
12 namespace content {
14 class RenderWidget;
16 // Enables switching between two modes of resizing:
17 // 1) The "normal" (asynchronous) resizing, which involves sending messages to
18 // and receiving them from host; and
19 // 2) The synchronous mode, which short-circuits the resizing logic to operate
20 // strictly inside renderer.
21 // The latter is necessary to support a handful of layout tests that were
22 // written with the expectation of a synchronous resize, and we're going to
23 // eventually rewrite or remove all of them. See http://crbug.com/309760 for
24 // details.
25 class ResizingModeSelector {
26 public:
27 ResizingModeSelector();
28 bool NeverUsesSynchronousResize() const;
29 bool ShouldAbortOnResize(RenderWidget* widget,
30 const ViewMsg_Resize_Params& params);
32 void set_is_synchronous_mode(bool mode);
33 bool is_synchronous_mode() const;
35 private:
36 bool is_synchronous_mode_;
38 DISALLOW_COPY_AND_ASSIGN(ResizingModeSelector);
41 } // namespace content
43 #endif // CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_