Fix Win8 metro startup crash from window switcher button
[chromium-blink-merge.git] / chrome_frame / infobars / internal / host_window_manager.h
blobcf2abac409286da311c6cbcb9986821d039ec2a1
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_HOST_WINDOW_MANAGER_H_
6 #define CHROME_FRAME_INFOBARS_INTERNAL_HOST_WINDOW_MANAGER_H_
8 #include "base/basictypes.h"
9 #include "chrome_frame/infobars/internal/subclassing_window_with_delegate.h"
11 class DisplacedWindowManager;
13 // HostWindowManager observes the HWND passed to Initialize and:
14 // 1) Monitors the lifecycle of a specific child window (as identified by
15 // FindDisplacedWindow).
16 // 2) Intercepts NCCALCSIZE events on the child window, allowing the client to
17 // modify the child window's requested dimensions.
18 // 3) Allows the client to request a recalculation of the child window's
19 // dimensions (resulting in a callback as in [2]).
21 // See documentation of SubclasingWindowWithDelegate for further information.
22 class HostWindowManager
23 : public SubclassingWindowWithDelegate<HostWindowManager> {
24 public:
25 HostWindowManager();
26 virtual ~HostWindowManager();
28 // Triggers an immediate re-evaluation of the dimensions of the displaced
29 // window. Delegate::AdjustDisplacedWindowDimensions will be called with the
30 // natural dimensions of the displaced window.
31 void UpdateLayout();
33 private:
34 class DisplacedWindowDelegate;
35 friend class DisplacedWindowDelegate;
37 // Finds the window to be displaced and instantiate a DisplacedWindowManager
38 // for it if one does not already exist. Returns true if
39 // displaced_window_manager_ is non-NULL at the end of the call.
40 bool FindDisplacedWindow(HWND old_window);
42 // Subclasses and observes changes to the displaced window.
43 DisplacedWindowManager* displaced_window_manager_;
45 DISALLOW_COPY_AND_ASSIGN(HostWindowManager);
46 }; // class HostWindowManager
48 #endif // CHROME_FRAME_INFOBARS_INTERNAL_HOST_WINDOW_MANAGER_H_