| 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 CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "content/public/browser/web_ui_controller.h" | 9 #include "content/public/browser/web_ui_controller.h" |
| 10 | 10 #include "ui/gfx/native_widget_types.h" |
| 11 class WebContentsModalDialog; | |
| 12 | 11 |
| 13 namespace content { | 12 namespace content { |
| 14 class BrowserContext; | 13 class BrowserContext; |
| 15 class RenderViewHost; | 14 class RenderViewHost; |
| 16 class WebContents; | 15 class WebContents; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace ui { | 18 namespace ui { |
| 20 class WebDialogDelegate; | 19 class WebDialogDelegate; |
| 21 class WebDialogWebContentsDelegate; | 20 class WebDialogWebContentsDelegate; |
| 22 } | 21 } |
| 23 | 22 |
| 24 class ConstrainedWebDialogDelegate { | 23 class ConstrainedWebDialogDelegate { |
| 25 public: | 24 public: |
| 26 virtual const ui::WebDialogDelegate* GetWebDialogDelegate() const = 0; | 25 virtual const ui::WebDialogDelegate* GetWebDialogDelegate() const = 0; |
| 27 virtual ui::WebDialogDelegate* GetWebDialogDelegate() = 0; | 26 virtual ui::WebDialogDelegate* GetWebDialogDelegate() = 0; |
| 28 | 27 |
| 29 // Called when the dialog is being closed in response to a "DialogClose" | 28 // Called when the dialog is being closed in response to a "DialogClose" |
| 30 // message from WebUI. | 29 // message from WebUI. |
| 31 virtual void OnDialogCloseFromWebUI() = 0; | 30 virtual void OnDialogCloseFromWebUI() = 0; |
| 32 | 31 |
| 33 // If called, on dialog closure, the dialog will release its WebContents | 32 // If called, on dialog closure, the dialog will release its WebContents |
| 34 // instead of destroying it. After which point, the caller will own the | 33 // instead of destroying it. After which point, the caller will own the |
| 35 // released WebContents. | 34 // released WebContents. |
| 36 virtual void ReleaseWebContentsOnDialogClose() = 0; | 35 virtual void ReleaseWebContentsOnDialogClose() = 0; |
| 37 | 36 |
| 38 // Returns the WebContentsModalDialog. | |
| 39 virtual WebContentsModalDialog* GetWindow() = 0; | |
| 40 | |
| 41 // Returns the WebContents owned by the constrained window. | 37 // Returns the WebContents owned by the constrained window. |
| 42 virtual content::WebContents* GetWebContents() = 0; | 38 virtual content::WebContents* GetWebContents() = 0; |
| 43 | 39 |
| 40 // Returns the NativeWindow used to display the dialog. |
| 41 virtual gfx::NativeWindow GetNativeWindow() = 0; |
| 42 |
| 44 protected: | 43 protected: |
| 45 virtual ~ConstrainedWebDialogDelegate() {} | 44 virtual ~ConstrainedWebDialogDelegate() {} |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 // ConstrainedWebDialogUI is a facility to show HTML WebUI content | 47 // ConstrainedWebDialogUI is a facility to show HTML WebUI content |
| 49 // in a tab-modal constrained dialog. It is implemented as an adapter | 48 // in a tab-modal constrained dialog. It is implemented as an adapter |
| 50 // between an WebDialogUI object and a WebContentsModalDialog object. | 49 // between an WebDialogUI object and a WebContentsModalDialog object. |
| 51 // | 50 // |
| 52 // Since WebContentsModalDialog requires platform-specific delegate | 51 // Since WebContentsModalDialog requires platform-specific delegate |
| 53 // implementations, this class is just a factory stub. | 52 // implementations, this class is just a factory stub. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // use the default one. The dialog takes ownership of | 89 // use the default one. The dialog takes ownership of |
| 91 // |tab_delegate|. | 90 // |tab_delegate|. |
| 92 // |overshadowed| is the tab being overshadowed by the dialog. | 91 // |overshadowed| is the tab being overshadowed by the dialog. |
| 93 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( | 92 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( |
| 94 content::BrowserContext* browser_context, | 93 content::BrowserContext* browser_context, |
| 95 ui::WebDialogDelegate* delegate, | 94 ui::WebDialogDelegate* delegate, |
| 96 ui::WebDialogWebContentsDelegate* tab_delegate, | 95 ui::WebDialogWebContentsDelegate* tab_delegate, |
| 97 content::WebContents* overshadowed); | 96 content::WebContents* overshadowed); |
| 98 | 97 |
| 99 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ | 98 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ |
| OLD | NEW |