1 // Copyright (c) 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.
5 #ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_
6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_
8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/gfx/point.h"
10 #include "ui/gfx/size.h"
14 // Observer to be implemented to update web contents modal dialogs when the host
15 // indicates their position needs to be changed.
16 class WebContentsModalDialogHostObserver
{
18 virtual ~WebContentsModalDialogHostObserver();
20 virtual void OnPositionRequiresUpdate() = 0;
21 virtual void OnHostDestroying() = 0;
24 WebContentsModalDialogHostObserver();
27 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostObserver
);
30 // Interface for supporting positioning of web contents modal dialogs over a
32 class WebContentsModalDialogHost
{
34 virtual ~WebContentsModalDialogHost();
36 // Returns the view against which the dialog is positioned and parented.
37 virtual gfx::NativeView
GetHostView() const = 0;
38 // Gets the position for the dialog in coordinates relative to the host
40 virtual gfx::Point
GetDialogPosition(const gfx::Size
& size
) = 0;
42 // Add/remove observer.
43 virtual void AddObserver(WebContentsModalDialogHostObserver
* observer
) = 0;
44 virtual void RemoveObserver(WebContentsModalDialogHostObserver
* observer
) = 0;
47 WebContentsModalDialogHost();
50 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHost
);
53 } // namespace web_modal
55 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_