OLD | NEW |
| (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_INFOBAR_CONTENT_H_ | |
6 #define CHROME_FRAME_INFOBARS_INFOBAR_CONTENT_H_ | |
7 | |
8 #include <windows.h> | |
9 | |
10 // Provides an interface between content to be displayed in an infobar and the | |
11 // infobar facility. Pass an instance of your implementation to | |
12 // InfobarManager::Show, which will result in a call to InstallInFrame to | |
13 // initialize the InfobarContent. | |
14 // | |
15 // The instance will be deleted by the infobar facility when it is no longer | |
16 // being displayed (or immediately, in the case of a failure to display). | |
17 class InfobarContent { | |
18 public: | |
19 // Provides access to the content's parent window and allows the | |
20 // InfobarContent to close itself, such as in response to user interaction. | |
21 class Frame { | |
22 public: | |
23 virtual ~Frame() {} | |
24 | |
25 // Returns the window in which the content should display itself. | |
26 virtual HWND GetFrameWindow() = 0; | |
27 | |
28 // Initiates closing of the infobar. | |
29 virtual void CloseInfobar() = 0; | |
30 }; // class Frame | |
31 | |
32 virtual ~InfobarContent() {} | |
33 | |
34 // Prepares the content to display in the provided frame. | |
35 // | |
36 // The frame pointer remains valid until the InfobarContent instance is | |
37 // deleted. | |
38 virtual bool InstallInFrame(Frame* frame) = 0; | |
39 | |
40 // Provides the content with the dimensions available to it for display. | |
41 // Dimensions are relative to the origin of the frame window. | |
42 virtual void SetDimensions(const RECT& dimensions) = 0; | |
43 | |
44 // Finds the desired value for one dimension given a fixed value for the other | |
45 // dimension. The fixed dimension parameter is non-zero whereas the requested | |
46 // dimension parameter will be zero. | |
47 virtual size_t GetDesiredSize(size_t width, size_t height) = 0; | |
48 }; // class InfobarContent | |
49 | |
50 #endif // CHROME_FRAME_INFOBARS_INFOBAR_CONTENT_H_ | |
OLD | NEW |