OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_BROWSER_UI_COCOA_HTML_DIALOG_WINDOW_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_HTML_DIALOG_WINDOW_CONTROLLER_H_ | |
7 #pragma once | |
8 | |
9 #import <Cocoa/Cocoa.h> | |
10 | |
11 #include "base/basictypes.h" | |
12 #import "base/mac/cocoa_protocols.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "chrome/browser/ui/webui/html_dialog_ui.h" | |
15 | |
16 class Browser; | |
17 class HtmlDialogWindowDelegateBridge; | |
18 class Profile; | |
19 class TabContentsWrapper; | |
20 | |
21 // This controller manages a dialog box with properties and HTML content taken | |
22 // from a HTMLDialogUIDelegate object. | |
23 @interface HtmlDialogWindowController : NSWindowController<NSWindowDelegate> { | |
24 @private | |
25 // Order here is important, as tab_contents_ may send messages to | |
26 // delegate_ when it gets destroyed. | |
27 scoped_ptr<HtmlDialogWindowDelegateBridge> delegate_; | |
28 scoped_ptr<TabContentsWrapper> contentsWrapper_; | |
29 } | |
30 | |
31 // Creates and shows an HtmlDialogWindowController with the given | |
32 // delegate and profile whose lifetime is controlled by the given | |
33 // browser. The window is automatically destroyed when it, or its | |
34 // controlling browser is closed. Returns the created window. | |
35 // | |
36 // Make sure to use the returned window only when you know it is safe | |
37 // to do so, i.e. before OnDialogClosed() is called on the delegate. | |
38 + (NSWindow*)showHtmlDialog:(HtmlDialogUIDelegate*)delegate | |
39 profile:(Profile*)profile | |
40 browser:(Browser*)browser; | |
41 | |
42 @end | |
43 | |
44 @interface HtmlDialogWindowController (TestingAPI) | |
45 | |
46 // This is the designated initializer. However, this is exposed only | |
47 // for testing; use showHtmlDialog instead. | |
48 - (id)initWithDelegate:(HtmlDialogUIDelegate*)delegate | |
49 profile:(Profile*)profile | |
50 browser:(Browser*)browser; | |
51 | |
52 // Loads the HTML content from the delegate; this is not a lightweight | |
53 // process which is why it is not part of the constructor. Must be | |
54 // called before showWindow. | |
55 - (void)loadDialogContents; | |
56 | |
57 @end | |
58 | |
59 #endif // CHROME_BROWSER_UI_COCOA_HTML_DIALOG_WINDOW_CONTROLLER_H_ | |
60 | |
OLD | NEW |