[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / constrained_window / constrained_window_views.h
1 // Copyright 2012 The Chromium Authors
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_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_
6 #define COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_
7
8 #include <memory>
9
10 #include "build/build_config.h"
11 #include "ui/gfx/native_widget_types.h"
12
13 namespace content {
14 class WebContents;
15 }
16
17 namespace ui {
18 class DialogModel;
19 }
20
21 namespace views {
22 class DialogDelegate;
23 class Widget;
24 class WidgetDelegate;
25 }
26
27 namespace web_modal {
28 class ModalDialogHost;
29 class WebContentsModalDialogHost;
30 }
31
32 namespace constrained_window {
33
34 extern const void* kConstrainedWindowWidgetIdentifier;
35
36 class ConstrainedWindowViewsClient;
37
38 // Sets the ConstrainedWindowClient impl.
39 void SetConstrainedWindowViewsClient(
40     std::unique_ptr<ConstrainedWindowViewsClient> client);
41
42 // Update the position of dialog |widget| against |dialog_host|. This is used to
43 // reposition widgets e.g. when the host dimensions change.
44 void UpdateWebContentsModalDialogPosition(
45     views::Widget* widget,
46     web_modal::WebContentsModalDialogHost* dialog_host);
47
48 void UpdateWidgetModalDialogPosition(
49     views::Widget* widget,
50     web_modal::ModalDialogHost* dialog_host);
51
52 // Returns the top level WebContents of |initiator_web_contents|.
53 content::WebContents* GetTopLevelWebContents(
54     content::WebContents* initiator_web_contents);
55
56 // Shows the dialog with a new SingleWebContentsDialogManager. The dialog will
57 // notify via WillClose() when it is being destroyed.
58 void ShowModalDialog(gfx::NativeWindow dialog,
59                      content::WebContents* web_contents);
60
61 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget.
62 views::Widget* ShowWebModalDialogViews(
63     views::WidgetDelegate* dialog,
64     content::WebContents* initiator_web_contents);
65
66 // Create a widget for |dialog| that is modal to |web_contents|.
67 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD.
68 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog,
69                                          content::WebContents* web_contents);
70
71 // Create a widget for |dialog| that has a modality given by
72 // |dialog->GetModalType()|.  The modal type must be either
73 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW.  This places the dialog
74 // appropriately if |parent| is a valid browser window. Currently, |parent| may
75 // be null for MODAL_TYPE_WINDOW, but that's a bug and callers shouldn't rely on
76 // that working. See http://crbug.com/657293. Instead of calling this function
77 // with null |parent| and MODAL_TYPE_WINDOW, consider calling views::
78 // DialogDelegate::CreateDialogWidget(dialog, nullptr, nullptr) instead.
79 // For dialogs that may appear without direct user interaction (i.e., that may
80 // appear while a user is busily accomplishing some other task in the browser),
81 // consider providing an override of GetDefaultDialogButton on |dialog| to
82 // suppress the normal behavior of choosing a focused-by-default button. This is
83 // especially important if the action of the default button has consequences on
84 // the user's task at hand.
85 views::Widget* CreateBrowserModalDialogViews(
86     std::unique_ptr<views::DialogDelegate> dialog,
87     gfx::NativeWindow parent);
88
89 // TODO(pbos): Transition calls to this to the unique_ptr<> version above.
90 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
91                                              gfx::NativeWindow parent);
92
93 // Shows a browser-modal dialog based on `dialog_model`, returns pointer
94 // to the created widget.
95 views::Widget* ShowBrowserModal(std::unique_ptr<ui::DialogModel> dialog_model,
96                                 gfx::NativeWindow parent);
97
98 // Shows a web/tab-modal dialog based on `dialog_model` and returns its widget.
99 views::Widget* ShowWebModal(std::unique_ptr<ui::DialogModel> dialog_model,
100                             content::WebContents* web_contents);
101
102 }  // namespace constrained_window
103
104 #endif  // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_