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