1 // Copyright (c) 2010 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 CHROME_FRAME_INFOBARS_INTERNAL_DISPLACED_WINDOW_MANAGER_H_
6 #define CHROME_FRAME_INFOBARS_INTERNAL_DISPLACED_WINDOW_MANAGER_H_
12 #include "base/basictypes.h"
13 #include "chrome_frame/infobars/internal/subclassing_window_with_delegate.h"
15 // DisplacedWindowManager observes the HWND passed to Initialize and:
16 // 1) Intercepts NCCALCSIZE events allowing the client to modify the window's
17 // requested dimensions.
18 // 2) Allows the client to request a recalculation of the window's dimensions
19 // (resulting in a deferred callback as in [1]).
20 // 3) Is destroyed only when the window is destroyed.
21 class DisplacedWindowManager
22 : public SubclassingWindowWithDelegate<DisplacedWindowManager> {
24 DisplacedWindowManager();
26 // Triggers an immediate re-evaluation of the dimensions of the displaced
27 // window. Delegate::AdjustDisplacedWindowDimensions will be called with the
28 // natural dimensions of the displaced window.
31 BEGIN_MSG_MAP_EX(DisplacedWindowManager)
32 MSG_WM_NCCALCSIZE(OnNcCalcSize)
33 CHAIN_MSG_MAP(SubclassingWindowWithDelegate<DisplacedWindowManager>)
37 // The size of the displaced window is being calculated. Allow
38 // InfobarWindows to reserve a part of the space for themselves, if they are
40 LRESULT OnNcCalcSize(BOOL calc_valid_rects, LPARAM lparam);
42 DISALLOW_COPY_AND_ASSIGN(DisplacedWindowManager);
43 }; // class DisplacedWindowManager
45 #endif // CHROME_FRAME_INFOBARS_INTERNAL_DISPLACED_WINDOW_MANAGER_H_