[email protected] | 00517a8 | 2013-10-09 22:19:30 | [diff] [blame] | 1 | // Copyright 2013 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 COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ |
| 6 | #define COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ |
| 7 | |
| 8 | #include "ui/gfx/native_widget_types.h" |
| 9 | |
| 10 | namespace gfx { |
| 11 | class Point; |
| 12 | class Size; |
| 13 | } // namespace gfx |
| 14 | |
| 15 | namespace web_modal { |
| 16 | |
| 17 | // Observer to be implemented to update modal dialogs when the host indicates |
| 18 | // their position needs to be changed. |
| 19 | class ModalDialogHostObserver { |
| 20 | public: |
| 21 | virtual ~ModalDialogHostObserver(); |
| 22 | |
| 23 | virtual void OnPositionRequiresUpdate() = 0; |
| 24 | virtual void OnHostDestroying() = 0; |
| 25 | }; |
| 26 | |
| 27 | // Interface for supporting positioning of modal dialogs over a window/widget. |
| 28 | class ModalDialogHost { |
| 29 | public: |
| 30 | virtual ~ModalDialogHost(); |
| 31 | |
| 32 | // Returns the view against which the dialog is positioned and parented. |
| 33 | virtual gfx::NativeView GetHostView() const = 0; |
[email protected] | 536b2f0 | 2013-12-10 23:28:50 | [diff] [blame] | 34 | // Gets the position for the dialog in coordinates relative to the host view. |
[email protected] | 00517a8 | 2013-10-09 22:19:30 | [diff] [blame] | 35 | virtual gfx::Point GetDialogPosition(const gfx::Size& size) = 0; |
Avi Drissman | 7154fd0 | 2017-10-30 19:50:41 | [diff] [blame] | 36 | // Returns whether a dialog currently about to be shown should be activated. |
| 37 | virtual bool ShouldActivateDialog() const; |
[email protected] | 00517a8 | 2013-10-09 22:19:30 | [diff] [blame] | 38 | |
| 39 | // Add/remove observer. |
| 40 | virtual void AddObserver(ModalDialogHostObserver* observer) = 0; |
| 41 | virtual void RemoveObserver(ModalDialogHostObserver* observer) = 0; |
| 42 | }; |
| 43 | |
| 44 | } // namespace web_modal |
| 45 | |
| 46 | #endif // COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ |