| 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 UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ | 5 #ifndef UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ |
| 6 #define UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ | 6 #define UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "content/public/browser/web_ui_controller.h" | 10 #include "content/public/browser/web_ui_controller.h" |
| 11 #include "ui/web_dialogs/web_dialogs_export.h" | 11 #include "ui/web_dialogs/web_dialogs_export.h" |
| 12 | 12 |
| 13 class ConstrainedWindow; | 13 class ConstrainedWindow; |
| 14 class Profile; | 14 class Profile; |
| 15 class TabContents; | 15 class TabContents; |
| 16 typedef TabContents TabContentsWrapper; | |
| 17 class WebDialogWebContentsDelegate; | 16 class WebDialogWebContentsDelegate; |
| 18 | 17 |
| 19 namespace base { | 18 namespace base { |
| 20 template<class T> class PropertyAccessor; | 19 template<class T> class PropertyAccessor; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace content { | 22 namespace content { |
| 24 class RenderViewHost; | 23 class RenderViewHost; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace ui { | 26 namespace ui { |
| 28 class WebDialogDelegate; | 27 class WebDialogDelegate; |
| 29 | 28 |
| 30 class WEB_DIALOGS_EXPORT ConstrainedWebDialogDelegate { | 29 class WEB_DIALOGS_EXPORT ConstrainedWebDialogDelegate { |
| 31 public: | 30 public: |
| 32 virtual const WebDialogDelegate* GetWebDialogDelegate() const = 0; | 31 virtual const WebDialogDelegate* GetWebDialogDelegate() const = 0; |
| 33 virtual WebDialogDelegate* GetWebDialogDelegate() = 0; | 32 virtual WebDialogDelegate* GetWebDialogDelegate() = 0; |
| 34 | 33 |
| 35 // Called when the dialog is being closed in response to a "DialogClose" | 34 // Called when the dialog is being closed in response to a "DialogClose" |
| 36 // message from WebUI. | 35 // message from WebUI. |
| 37 virtual void OnDialogCloseFromWebUI() = 0; | 36 virtual void OnDialogCloseFromWebUI() = 0; |
| 38 | 37 |
| 39 // If called, on dialog closure, the dialog will release its WebContents | 38 // If called, on dialog closure, the dialog will release its WebContents |
| 40 // instead of destroying it. After which point, the caller will own the | 39 // instead of destroying it. After which point, the caller will own the |
| 41 // released WebContents. | 40 // released WebContents. |
| 42 virtual void ReleaseTabContentsOnDialogClose() = 0; | 41 virtual void ReleaseTabContentsOnDialogClose() = 0; |
| 43 | 42 |
| 44 // Returns the ConstrainedWindow. | 43 // Returns the ConstrainedWindow. |
| 44 // TODO: fix this function name and the one below to conform to the style |
| 45 // guide (i.e. GetWindow, GetTab). |
| 45 virtual ConstrainedWindow* window() = 0; | 46 virtual ConstrainedWindow* window() = 0; |
| 46 | 47 |
| 47 // Returns the TabContentsWrapper owned by the constrained window. | 48 // Returns the TabContents owned by the constrained window. |
| 48 virtual TabContentsWrapper* tab() = 0; | 49 virtual TabContents* tab() = 0; |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 virtual ~ConstrainedWebDialogDelegate() {} | 52 virtual ~ConstrainedWebDialogDelegate() {} |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 // ConstrainedWebDialogUI is a facility to show HTML WebUI content | 55 // ConstrainedWebDialogUI is a facility to show HTML WebUI content |
| 55 // in a tab-modal constrained dialog. It is implemented as an adapter | 56 // in a tab-modal constrained dialog. It is implemented as an adapter |
| 56 // between an WebDialogUI object and a ConstrainedWindow object. | 57 // between an WebDialogUI object and a ConstrainedWindow object. |
| 57 // | 58 // |
| 58 // Since ConstrainedWindow requires platform-specific delegate | 59 // Since ConstrainedWindow requires platform-specific delegate |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // |delegate| controls the behavior of the dialog. | 94 // |delegate| controls the behavior of the dialog. |
| 94 // |tab_delegate| is optional, pass one in to use a custom | 95 // |tab_delegate| is optional, pass one in to use a custom |
| 95 // WebDialogWebContentsDelegate with the dialog, or NULL to | 96 // WebDialogWebContentsDelegate with the dialog, or NULL to |
| 96 // use the default one. The dialog takes ownership of | 97 // use the default one. The dialog takes ownership of |
| 97 // |tab_delegate|. | 98 // |tab_delegate|. |
| 98 // |overshadowed| is the tab being overshadowed by the dialog. | 99 // |overshadowed| is the tab being overshadowed by the dialog. |
| 99 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( | 100 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( |
| 100 Profile* profile, | 101 Profile* profile, |
| 101 WebDialogDelegate* delegate, | 102 WebDialogDelegate* delegate, |
| 102 WebDialogWebContentsDelegate* tab_delegate, | 103 WebDialogWebContentsDelegate* tab_delegate, |
| 103 TabContentsWrapper* overshadowed); | 104 TabContents* overshadowed); |
| 104 | 105 |
| 105 } // namespace ui | 106 } // namespace ui |
| 106 | 107 |
| 107 #endif // UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ | 108 #endif // UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ |
| OLD | NEW |