summaryrefslogtreecommitdiffstats
path: root/content/renderer/resizing_mode_selector.h
blob: ac657e294cde8ffd18364aee822cc93de1142be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_
#define CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_

#include "base/basictypes.h"

struct ViewMsg_Resize_Params;

namespace content {

class RenderWidget;

// Enables switching between two modes of resizing:
// 1) The "normal" (asynchronous) resizing, which involves sending messages to
//    and receiving them from host; and
// 2) The synchronous mode, which short-circuits the resizing logic to operate
//    strictly inside renderer.
// The latter is necessary to support a handful of layout tests that were
// written with the expectation of a synchronous resize, and we're going to
// eventually rewrite or remove all of them. See http://crbug.com/309760 for
// details.
class ResizingModeSelector {
 public:
  ResizingModeSelector();
  bool NeverUsesSynchronousResize() const;
  bool ShouldAbortOnResize(RenderWidget* widget,
                           const ViewMsg_Resize_Params& params);

  void set_is_synchronous_mode(bool mode);
  bool is_synchronous_mode() const;

 private:
  bool is_synchronous_mode_;

  DISALLOW_COPY_AND_ASSIGN(ResizingModeSelector);
};

}  // namespace content

#endif  // CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_