| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ | 5 #ifndef COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ |
| 6 #define COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ | 6 #define COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 class WebContents; | 12 class WebContents; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class DialogDelegate; | 16 class DialogDelegate; |
| 17 class Widget; | 17 class Widget; |
| 18 class WidgetDelegate; | 18 class WidgetDelegate; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace web_modal { | 21 namespace web_modal { |
| 22 class ModalDialogHost; | 22 class ModalDialogHost; |
| 23 class PopupManager; |
| 23 class WebContentsModalDialogHost; | 24 class WebContentsModalDialogHost; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace constrained_window { | 27 namespace constrained_window { |
| 27 | 28 |
| 28 class ConstrainedWindowViewsClient; | 29 class ConstrainedWindowViewsClient; |
| 29 | 30 |
| 30 // Sets the ConstrainedWindowClient impl. | 31 // Sets the ConstrainedWindowClient impl. |
| 31 void SetConstrainedWindowViewsClient( | 32 void SetConstrainedWindowViewsClient( |
| 32 scoped_ptr<ConstrainedWindowViewsClient> client); | 33 scoped_ptr<ConstrainedWindowViewsClient> client); |
| 33 | 34 |
| 34 // Update the position of dialog |widget| against |dialog_host|. This is used to | 35 // Update the position of dialog |widget| against |dialog_host|. This is used to |
| 35 // reposition widgets e.g. when the host dimensions change. | 36 // reposition widgets e.g. when the host dimensions change. |
| 36 void UpdateWebContentsModalDialogPosition( | 37 void UpdateWebContentsModalDialogPosition( |
| 37 views::Widget* widget, | 38 views::Widget* widget, |
| 38 web_modal::WebContentsModalDialogHost* dialog_host); | 39 web_modal::WebContentsModalDialogHost* dialog_host); |
| 39 | 40 |
| 40 void UpdateWidgetModalDialogPosition( | 41 void UpdateWidgetModalDialogPosition( |
| 41 views::Widget* widget, | 42 views::Widget* widget, |
| 42 web_modal::ModalDialogHost* dialog_host); | 43 web_modal::ModalDialogHost* dialog_host); |
| 43 | 44 |
| 45 // Returns popup manager, if any, for WebContents. |
| 46 web_modal::PopupManager* PopupManager(content::WebContents* web_contents); |
| 47 |
| 44 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget. | 48 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget. |
| 45 views::Widget* ShowWebModalDialogViews( | 49 views::Widget* ShowWebModalDialogViews( |
| 46 views::WidgetDelegate* dialog, | 50 views::WidgetDelegate* dialog, |
| 47 content::WebContents* initiator_web_contents); | 51 content::WebContents* initiator_web_contents); |
| 48 | 52 |
| 49 // Create a widget for |dialog| that is modal to |web_contents|. | 53 // Create a widget for |dialog| that is modal to |web_contents|. |
| 50 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD. | 54 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD. |
| 51 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, | 55 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |
| 52 content::WebContents* web_contents); | 56 content::WebContents* web_contents); |
| 53 | 57 |
| 54 // Create a widget for |dialog| that has a modality given by | 58 // Create a widget for |dialog| that has a modality given by |
| 55 // |dialog->GetModalType()|. The modal type must be either | 59 // |dialog->GetModalType()|. The modal type must be either |
| 56 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW. This places the | 60 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW. This places the |
| 57 // dialog appropriately if |parent| is a valid browser window. | 61 // dialog appropriately if |parent| is a valid browser window. |
| 58 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, | 62 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, |
| 59 gfx::NativeWindow parent); | 63 gfx::NativeWindow parent); |
| 60 | 64 |
| 61 } // namespace constrained window | 65 } // namespace constrained window |
| 62 | 66 |
| 63 #endif // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ | 67 #endif // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ |
| OLD | NEW |