Home | History | Annotate | Download | only in renderer
      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.
      4 
      5 #ifndef CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_
      6 #define CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_
      7 
      8 #include "base/basictypes.h"
      9 
     10 struct ViewMsg_Resize_Params;
     11 
     12 namespace content {
     13 
     14 class RenderWidget;
     15 
     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);
     31 
     32   void set_is_synchronous_mode(bool mode);
     33   bool is_synchronous_mode() const;
     34 
     35  private:
     36   bool is_synchronous_mode_;
     37 
     38   DISALLOW_COPY_AND_ASSIGN(ResizingModeSelector);
     39 };
     40 
     41 }  // namespace content
     42 
     43 #endif  // CONTENT_RENDERER_RESIZING_MODE_SELECTOR_H_
     44