BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / web_contents_modal_dialog_manager_views_mac.h
blob093bc11cdfcb23066fbc1eff742e3e428d59aafe
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_WEB_CONTENTS_MODAL_DIALOG_MANAGER_VIEWS_MAC_H_
6 #define CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_MODAL_DIALOG_MANAGER_VIEWS_MAC_H_
8 #import "base/mac/scoped_nsobject.h"
9 #include "components/web_modal/single_web_contents_dialog_manager.h"
10 #include "ui/views/widget/widget_observer.h"
12 @class NSWindow;
13 @class WrappedConstrainedWindowSheet;
15 // WebContents dialog manager for a toolkit-views dialog parented off a Cocoa
16 // browser window. Most of the modality behavior is still performed by the Cocoa
17 // based ConstrainedWindowSheetController. This class bridges the expectations
18 // of a toolkit-views dialog to the Cocoa ConstrainedWindowSheetController.
19 // Note that this is not a web_modal::ModalDialogHostObserver. This is because
20 // tabs in a Cocoa browser can't be dragged off their window if they have a tab-
21 // modal dialog open, so the ModalDialogHost is only used by the views plumbing
22 // when creating the dialog.
23 class SingleWebContentsDialogManagerViewsMac
24 : public web_modal::SingleWebContentsDialogManager,
25 public views::WidgetObserver {
26 public:
27 SingleWebContentsDialogManagerViewsMac(
28 NSWindow* dialog,
29 web_modal::SingleWebContentsDialogManagerDelegate* delegate);
31 ~SingleWebContentsDialogManagerViewsMac() override;
33 // SingleWebContentsDialogManager:
34 void Show() override;
35 void Hide() override;
36 void Close() override;
37 void Focus() override;
38 void Pulse() override;
39 void HostChanged(web_modal::WebContentsModalDialogHost* new_host) override;
40 gfx::NativeWindow dialog() override;
42 // views::WidgetObserver:
43 void OnWidgetClosing(views::Widget* widget) override;
44 void OnWidgetDestroying(views::Widget* widget) override;
46 private:
47 base::scoped_nsobject<WrappedConstrainedWindowSheet> sheet_;
48 // Weak. Owns this.
49 web_modal::SingleWebContentsDialogManagerDelegate* delegate_;
50 // Weak. Owned by parent window.
51 web_modal::WebContentsModalDialogHost* host_;
53 views::Widget* widget_; // Weak. Deletes |this| when closing.
55 DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManagerViewsMac);
58 #endif // CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_MODAL_DIALOG_MANAGER_VIEWS_MAC_H_