1 // Copyright (c) 2012 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_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_
6 #define COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/native_widget_types.h"
22 class ModalDialogHost
;
23 class WebContentsModalDialogHost
;
26 class ConstrainedWindowViewsClient
;
28 // Sets the ConstrainedWindowClient impl.
29 void SetConstrainedWindowViewsClient(
30 scoped_ptr
<ConstrainedWindowViewsClient
> client
);
32 // Update the position of dialog |widget| against |dialog_host|. This is used to
33 // reposition widgets e.g. when the host dimensions change.
34 void UpdateWebContentsModalDialogPosition(
35 views::Widget
* widget
,
36 web_modal::WebContentsModalDialogHost
* dialog_host
);
38 void UpdateWidgetModalDialogPosition(
39 views::Widget
* widget
,
40 web_modal::ModalDialogHost
* dialog_host
);
42 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget.
43 views::Widget
* ShowWebModalDialogViews(
44 views::WidgetDelegate
* dialog
,
45 content::WebContents
* initiator_web_contents
);
47 // Create a widget for |dialog| that is modal to |web_contents|.
48 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD.
49 views::Widget
* CreateWebModalDialogViews(views::WidgetDelegate
* dialog
,
50 content::WebContents
* web_contents
);
52 // Create a widget for |dialog| that has a modality given by
53 // |dialog->GetModalType()|. The modal type must be either
54 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW. This places the
55 // dialog appropriately if |parent| is a valid browser window.
56 views::Widget
* CreateBrowserModalDialogViews(views::DialogDelegate
* dialog
,
57 gfx::NativeView parent
);
59 #endif // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_