| 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 #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 | 11 |
| 12 class ConstrainedWindow; | 12 class ConstrainedWindow; |
| 13 class Profile; | 13 class Profile; |
| 14 class TabContentsWrapper; | 14 class TabContentsWrapper; |
| 15 |
| 16 namespace views { |
| 15 class WebDialogDelegate; | 17 class WebDialogDelegate; |
| 16 class WebDialogWebContentsDelegate; | 18 } |
| 19 class ChromeWebDialogWebContentsDelegate; |
| 17 | 20 |
| 18 namespace base { | 21 namespace base { |
| 19 template<class T> class PropertyAccessor; | 22 template<class T> class PropertyAccessor; |
| 20 } | 23 } |
| 21 | 24 |
| 22 namespace content { | 25 namespace content { |
| 23 class RenderViewHost; | 26 class RenderViewHost; |
| 24 } | 27 } |
| 25 | 28 |
| 26 class ConstrainedWebDialogDelegate { | 29 class ConstrainedWebDialogDelegate { |
| 27 public: | 30 public: |
| 28 virtual const WebDialogDelegate* GetWebDialogDelegate() const = 0; | 31 virtual const views::WebDialogDelegate* GetWebDialogDelegate() const = 0; |
| 29 virtual WebDialogDelegate* GetWebDialogDelegate() = 0; | 32 virtual views::WebDialogDelegate* GetWebDialogDelegate() = 0; |
| 30 | 33 |
| 31 // 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" |
| 32 // message from WebUI. | 35 // message from WebUI. |
| 33 virtual void OnDialogCloseFromWebUI() = 0; | 36 virtual void OnDialogCloseFromWebUI() = 0; |
| 34 | 37 |
| 35 // If called, on dialog closure, the dialog will release its WebContents | 38 // If called, on dialog closure, the dialog will release its WebContents |
| 36 // 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 |
| 37 // released WebContents. | 40 // released WebContents. |
| 38 virtual void ReleaseTabContentsOnDialogClose() = 0; | 41 virtual void ReleaseTabContentsOnDialogClose() = 0; |
| 39 | 42 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 69 // ConstrainedWebDialogUI object. | 72 // ConstrainedWebDialogUI object. |
| 70 // |profile| is used to construct the constrained HTML dialog's WebContents. | 73 // |profile| is used to construct the constrained HTML dialog's WebContents. |
| 71 // |delegate| controls the behavior of the dialog. | 74 // |delegate| controls the behavior of the dialog. |
| 72 // |tab_delegate| is optional, pass one in to use a custom | 75 // |tab_delegate| is optional, pass one in to use a custom |
| 73 // WebDialogWebContentsDelegate with the dialog, or NULL to | 76 // WebDialogWebContentsDelegate with the dialog, or NULL to |
| 74 // use the default one. The dialog takes ownership of | 77 // use the default one. The dialog takes ownership of |
| 75 // |tab_delegate|. | 78 // |tab_delegate|. |
| 76 // |overshadowed| is the tab being overshadowed by the dialog. | 79 // |overshadowed| is the tab being overshadowed by the dialog. |
| 77 static ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( | 80 static ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( |
| 78 Profile* profile, | 81 Profile* profile, |
| 79 WebDialogDelegate* delegate, | 82 views::WebDialogDelegate* delegate, |
| 80 WebDialogWebContentsDelegate* tab_delegate, | 83 ChromeWebDialogWebContentsDelegate* tab_delegate, |
| 81 TabContentsWrapper* overshadowed); | 84 TabContentsWrapper* overshadowed); |
| 82 | 85 |
| 83 // Returns a property accessor that can be used to set the | 86 // Returns a property accessor that can be used to set the |
| 84 // ConstrainedWebDialogDelegate property on a WebContents. | 87 // ConstrainedWebDialogDelegate property on a WebContents. |
| 85 static base::PropertyAccessor<ConstrainedWebDialogDelegate*>& | 88 static base::PropertyAccessor<ConstrainedWebDialogDelegate*>& |
| 86 GetPropertyAccessor(); | 89 GetPropertyAccessor(); |
| 87 | 90 |
| 88 protected: | 91 protected: |
| 89 // Returns the WebContents' PropertyBag's ConstrainedWebDialogDelegate. | 92 // Returns the WebContents' PropertyBag's ConstrainedWebDialogDelegate. |
| 90 // Returns NULL if that property is not set. | 93 // Returns NULL if that property is not set. |
| 91 ConstrainedWebDialogDelegate* GetConstrainedDelegate(); | 94 ConstrainedWebDialogDelegate* GetConstrainedDelegate(); |
| 92 | 95 |
| 93 private: | 96 private: |
| 94 // JS Message Handler | 97 // JS Message Handler |
| 95 void OnDialogCloseMessage(const base::ListValue* args); | 98 void OnDialogCloseMessage(const base::ListValue* args); |
| 96 | 99 |
| 97 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogUI); | 100 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogUI); |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ | 103 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ |
| OLD | NEW |