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