1 // Copyright 2015 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_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_COCOA_H_
8 #import "base/mac/scoped_nsobject.h"
9 #include "components/web_modal/single_web_contents_dialog_manager.h"
11 class ConstrainedWindowMac
;
12 @protocol ConstrainedWindowSheet
;
14 // Cocoa implementation of web_modal::SingleWebContentsDialogManager for showing
15 // native Cocoa sheet dialogs (of various kinds).
16 class SingleWebContentsDialogManagerCocoa
17 : public web_modal::SingleWebContentsDialogManager
{
19 SingleWebContentsDialogManagerCocoa(
20 ConstrainedWindowMac
* client
,
21 id
<ConstrainedWindowSheet
> sheet
,
22 web_modal::SingleWebContentsDialogManagerDelegate
* delegate
);
23 ~SingleWebContentsDialogManagerCocoa() override
;
25 // SingleWebContentsDialogManager overrides.
28 void Close() override
;
29 void Focus() override
;
30 void Pulse() override
;
31 void HostChanged(web_modal::WebContentsModalDialogHost
* new_host
) override
;
32 gfx::NativeWindow
dialog() override
;
35 // Weak. Legacy DialogManager-style delegate interface that Cocoa uses.
36 ConstrainedWindowMac
* client_
;
37 base::scoped_nsprotocol
<id
<ConstrainedWindowSheet
>> sheet_
;
39 web_modal::SingleWebContentsDialogManagerDelegate
* delegate_
;
40 // Weak. Owned by parent window.
41 web_modal::WebContentsModalDialogHost
* host_
;
43 DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManagerCocoa
);
46 #endif // CHROME_BROWSER_UI_COCOA_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_COCOA_H_