Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: chrome_frame/infobars/internal/host_window.h

Issue 4766003: Preview CL for adding an Infobar facility to Google Chrome Frame.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_FRAME_INFOBARS_INTERNAL_HOST_WINDOW_H_
6 #define CHROME_FRAME_INFOBARS_INTERNAL_HOST_WINDOW_H_
7
8 #include <atlbase.h>
9 #include <atlapp.h> // Must be included AFTER base.
tommi (sloooow) - chröme 2010/11/24 16:08:24 what functionality from atlapp.h do you need? look
erikwright (departed) 2010/12/01 20:05:52 CWindowImpl in atlwin.h, which was transiently inc
10 #include <atlcrack.h>
tommi (sloooow) - chröme 2010/11/24 16:08:24 ... and I think atlwin depends on atlcrack... or r
erikwright (departed) 2010/12/01 20:05:52 Yep. Sadly, I need both for CWindowImpl.
11
12 #include "base/basictypes.h"
13 #include "base/scoped_ptr.h"
14
15 class DisplacedWindowManager;
16
17 // HostWindowManager observes the HWND passed to Initialize and:
18 // 1) Monitors the lifecycle of a specific child window (as identified by
19 // FindDisplacedWindow).
20 // 2) Intercepts NCCALCSIZE events on the child window, allowing the client to
21 // modify the child window's requested dimensions.
22 // 3) Allows the client to request a recalculation of the child window's
23 // dimensions (resulting in a deferred callback as in [2]).
24 class HostWindowManager
25 : public CWindowImpl<HostWindowManager> {
26 public:
27 class Delegate {
28 public:
29 virtual ~Delegate() {}
30 // Receives the natural dimensions of the displaced window. Upon return,
31 // rect should contain the adjusted dimensions (i.e., possibly reduced to
32 // accomodate an infobar).
33 virtual void AdjustDisplacedWindowDimensions(RECT* rect) = 0;
34 };
35
36 static Delegate* GetDelegateForHostHwnd(HWND host_window);
37
38 HostWindowManager();
39 ~HostWindowManager();
40
41 // Returns true if observation of the host window starts successfully, in
42 // which case this instance will take responsibility for its own destruction
43 // when the window is destroyed. If this method returns false, the caller
44 // should delete the instance immediately.
45 //
46 // Takes ownership of delegate in either case, deleting it when this instance
47 // is deleted.
48 bool Initialize(HWND host_window, Delegate* delegate);
49
50 // Triggers a deferred re-evaluation of the dimensions of the displaced
51 // window. Delegate::AdjustDisplacedWindowDimensions will be called with the
52 // natural dimensions of the displaced window. Returns true if successful (in
53 // which case the callback is guaranteed).
54 bool UpdateLayout();
55
56 BEGIN_MSG_MAP_EX(HostWindowManager)
57 MESSAGE_HANDLER(WM_GET_DELEGATE, OnGetDelegate)
58 END_MSG_MAP()
59
60 protected:
61 virtual void OnFinalMessage(HWND /*hWnd*/);
tommi (sloooow) - chröme 2010/11/24 16:08:24 remove /* */
erikwright (departed) 2010/12/01 20:05:52 Thanks. It's quite confusing that we comment them
62
63 private:
64 class DisplacedWindowDelegate;
65
66 friend class DisplacedWindowDelegate;
67
68 enum {
69 WM_GET_DELEGATE = WM_APP + 1982
tommi (sloooow) - chröme 2010/11/24 16:08:24 hah, that's the first time an enum made me age con
erikwright (departed) 2010/12/01 20:05:52 Done ;)
70 };
71
72 LRESULT OnGetDelegate(UINT message,
73 WPARAM wparam,
74 LPARAM lparam,
75 BOOL& handled);
76 // Finds the window to be displaced and instantiate a DisplacedWindowManager
tommi (sloooow) - chröme 2010/11/24 16:08:24 add empty line
erikwright (departed) 2010/12/01 20:05:52 Done.
77 // for it if one does not already exist. Returns true if there is a valid
78 // DisplacedWindowManager instance at the end of the call.
79 bool FindDisplacedWindow(HWND old_window);
80
81 // Called by DisplacedWindowDelegate
82 void AdjustDisplacedWindowDimensions(RECT* rect);
83 void OnDisplacedWindowDestroyed();
84
85 scoped_ptr<Delegate> delegate_;
86 // Subclasses and observes changes to the displaced window.
87 DisplacedWindowManager* displaced_window_manager_;
88
89 DISALLOW_COPY_AND_ASSIGN(HostWindowManager);
90 };
91
92 #endif // CHROME_FRAME_INFOBARS_INTERNAL_HOST_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698