| 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_WEB_DIALOG_WINDOW_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_COCOA_WEB_DIALOG_WINDOW_CONTROLLER_H_ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/web_dialogs/web_dialog_ui.h" | |
| 12 | |
| 13 class WebDialogWindowDelegateBridge; | |
| 14 | |
| 15 namespace content { | |
| 16 class BrowserContext; | |
| 17 class WebContents; | |
| 18 } | |
| 19 | |
| 20 // This controller manages a dialog box with properties and HTML content taken | |
| 21 // from a WebDialogDelegate object. | |
| 22 @interface WebDialogWindowController : NSWindowController<NSWindowDelegate> { | |
| 23 @private | |
| 24 // Order here is important, as webContents_ may send messages to | |
| 25 // delegate_ when it gets destroyed. | |
| 26 scoped_ptr<WebDialogWindowDelegateBridge> delegate_; | |
| 27 scoped_ptr<content::WebContents> webContents_; | |
| 28 } | |
| 29 | |
| 30 // Creates and shows an WebDialogWindowController with the given | |
| 31 // delegate and profile. The window is automatically destroyed when it, or its | |
| 32 // profile, is closed. Returns the created window. | |
| 33 // | |
| 34 // Make sure to use the returned window only when you know it is safe | |
| 35 // to do so, i.e. before OnDialogClosed() is called on the delegate. | |
| 36 + (NSWindow*)showWebDialog:(ui::WebDialogDelegate*)delegate | |
| 37 context:(content::BrowserContext*)context; | |
| 38 | |
| 39 @end | |
| 40 | |
| 41 @interface WebDialogWindowController (TestingAPI) | |
| 42 | |
| 43 // This is the designated initializer. However, this is exposed only | |
| 44 // for testing; use -showWebDialog:context: instead. | |
| 45 - (id)initWithDelegate:(ui::WebDialogDelegate*)delegate | |
| 46 context:(content::BrowserContext*)context; | |
| 47 | |
| 48 // Loads the HTML content from the delegate; this is not a lightweight | |
| 49 // process which is why it is not part of the constructor. Must be | |
| 50 // called before -showWebDialog:context:. | |
| 51 - (void)loadDialogContents; | |
| 52 | |
| 53 @end | |
| 54 | |
| 55 #endif // CHROME_BROWSER_UI_COCOA_WEB_DIALOG_WINDOW_CONTROLLER_H_ | |
| OLD | NEW |