| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_DIALOG_HOST_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_DIALOG_HOST_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_DIALOG_HOST_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_DIALOG_HOST_COCOA_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 10 | 11 |
| 11 @class ConstrainedWindowSheetController; | 12 @class ConstrainedWindowSheetController; |
| 12 | 13 |
| 13 // In a Cocoa browser, the modal dialog host is a simple bridge to the | 14 // In a Cocoa browser, the modal dialog host is a simple bridge to the |
| 14 // ConstrainedWindowSheetController to get the dialog size and parent window. | 15 // ConstrainedWindowSheetController to get the dialog size and parent window. |
| 15 class WebContentsModalDialogHostCocoa | 16 class WebContentsModalDialogHostCocoa |
| 16 : public web_modal::WebContentsModalDialogHost { | 17 : public web_modal::WebContentsModalDialogHost { |
| 17 public: | 18 public: |
| 18 explicit WebContentsModalDialogHostCocoa( | 19 explicit WebContentsModalDialogHostCocoa( |
| 19 ConstrainedWindowSheetController* sheet_controller); | 20 ConstrainedWindowSheetController* sheet_controller); |
| 20 ~WebContentsModalDialogHostCocoa() override; | 21 ~WebContentsModalDialogHostCocoa() override; |
| 21 | 22 |
| 23 void OnPositionRequiresUpdate(); |
| 24 |
| 22 // web_modal::ModalDialogHost: | 25 // web_modal::ModalDialogHost: |
| 23 gfx::NativeView GetHostView() const override; | 26 gfx::NativeView GetHostView() const override; |
| 24 gfx::Point GetDialogPosition(const gfx::Size& size) override; | 27 gfx::Point GetDialogPosition(const gfx::Size& size) override; |
| 28 gfx::Point GetHostPosition() const override; |
| 25 void AddObserver(web_modal::ModalDialogHostObserver* observer) override; | 29 void AddObserver(web_modal::ModalDialogHostObserver* observer) override; |
| 26 void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override; | 30 void RemoveObserver(web_modal::ModalDialogHostObserver* observer) override; |
| 27 | 31 |
| 28 // web_modal::WebContentsModalDialogHost: | 32 // web_modal::WebContentsModalDialogHost: |
| 29 gfx::Size GetMaximumDialogSize() override; | 33 gfx::Size GetMaximumDialogSize() override; |
| 30 | 34 |
| 31 private: | 35 private: |
| 32 ConstrainedWindowSheetController* sheet_controller_; // Weak. Owns |this|. | 36 ConstrainedWindowSheetController* sheet_controller_; // Weak. Owns |this|. |
| 37 base::ObserverList<web_modal::ModalDialogHostObserver> observers_; |
| 33 | 38 |
| 34 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostCocoa); | 39 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostCocoa); |
| 35 }; | 40 }; |
| 36 | 41 |
| 37 #endif // CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_DIALOG_HOST_COCOA_H_ | 42 #endif // CHROME_BROWSER_UI_COCOA_WEB_CONTENTS_DIALOG_HOST_COCOA_H_ |
| OLD | NEW |