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 namespace constrained_window
{
28 class ConstrainedWindowViewsClient
;
30 // Sets the ConstrainedWindowClient impl.
31 void SetConstrainedWindowViewsClient(
32 scoped_ptr
<ConstrainedWindowViewsClient
> client
);
34 // Update the position of dialog |widget| against |dialog_host|. This is used to
35 // reposition widgets e.g. when the host dimensions change.
36 void UpdateWebContentsModalDialogPosition(
37 views::Widget
* widget
,
38 web_modal::WebContentsModalDialogHost
* dialog_host
);
40 void UpdateWidgetModalDialogPosition(
41 views::Widget
* widget
,
42 web_modal::ModalDialogHost
* dialog_host
);
44 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget.
45 views::Widget
* ShowWebModalDialogViews(
46 views::WidgetDelegate
* dialog
,
47 content::WebContents
* initiator_web_contents
);
49 // Create a widget for |dialog| that is modal to |web_contents|.
50 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD.
51 views::Widget
* CreateWebModalDialogViews(views::WidgetDelegate
* dialog
,
52 content::WebContents
* web_contents
);
54 // Create a widget for |dialog| that has a modality given by
55 // |dialog->GetModalType()|. The modal type must be either
56 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW. This places the
57 // dialog appropriately if |parent| is a valid browser window.
58 views::Widget
* CreateBrowserModalDialogViews(views::DialogDelegate
* dialog
,
59 gfx::NativeWindow parent
);
61 } // namespace constrained window
63 #endif // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_