| 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_HTML_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_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 HtmlDialogTabContentsDelegate; | 13 class HtmlDialogTabContentsDelegate; |
| 14 class HtmlDialogUIDelegate; | 14 class HtmlDialogUIDelegate; |
| 15 class Profile; | 15 class Profile; |
| 16 class RenderViewHost; | |
| 17 class TabContentsWrapper; | 16 class TabContentsWrapper; |
| 18 | 17 |
| 19 namespace base { | 18 namespace base { |
| 20 template<class T> class PropertyAccessor; | 19 template<class T> class PropertyAccessor; |
| 21 } | 20 } |
| 22 | 21 |
| 22 namespace content { |
| 23 class RenderViewHost; |
| 24 } |
| 25 |
| 23 class ConstrainedHtmlUIDelegate { | 26 class ConstrainedHtmlUIDelegate { |
| 24 public: | 27 public: |
| 25 virtual const HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() const = 0; | 28 virtual const HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() const = 0; |
| 26 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0; | 29 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0; |
| 27 | 30 |
| 28 // Called when the dialog is being closed in response to a "DialogClose" | 31 // Called when the dialog is being closed in response to a "DialogClose" |
| 29 // message from WebUI. | 32 // message from WebUI. |
| 30 virtual void OnDialogCloseFromWebUI() = 0; | 33 virtual void OnDialogCloseFromWebUI() = 0; |
| 31 | 34 |
| 32 // If called, on dialog closure, the dialog will release its WebContents | 35 // If called, on dialog closure, the dialog will release its WebContents |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 // Since ConstrainedWindow requires platform-specific delegate | 54 // Since ConstrainedWindow requires platform-specific delegate |
| 52 // implementations, this class is just a factory stub. | 55 // implementations, this class is just a factory stub. |
| 53 // TODO(thestig) Refactor the platform-independent code out of the | 56 // TODO(thestig) Refactor the platform-independent code out of the |
| 54 // platform-specific implementations. | 57 // platform-specific implementations. |
| 55 class ConstrainedHtmlUI : public content::WebUIController { | 58 class ConstrainedHtmlUI : public content::WebUIController { |
| 56 public: | 59 public: |
| 57 explicit ConstrainedHtmlUI(content::WebUI* web_ui); | 60 explicit ConstrainedHtmlUI(content::WebUI* web_ui); |
| 58 virtual ~ConstrainedHtmlUI(); | 61 virtual ~ConstrainedHtmlUI(); |
| 59 | 62 |
| 60 // WebUIController implementation: | 63 // WebUIController implementation: |
| 61 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 64 virtual void RenderViewCreated( |
| 65 content::RenderViewHost* render_view_host) OVERRIDE; |
| 62 | 66 |
| 63 // Create a constrained HTML dialog. The actual object that gets created | 67 // Create a constrained HTML dialog. The actual object that gets created |
| 64 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a | 68 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a |
| 65 // ConstrainedHtmlUI object. | 69 // ConstrainedHtmlUI object. |
| 66 // |profile| is used to construct the constrained HTML dialog's WebContents. | 70 // |profile| is used to construct the constrained HTML dialog's WebContents. |
| 67 // |delegate| controls the behavior of the dialog. | 71 // |delegate| controls the behavior of the dialog. |
| 68 // |tab_delegate| is optional, pass one in to use a custom | 72 // |tab_delegate| is optional, pass one in to use a custom |
| 69 // HtmlDialogTabContentsDelegate with the dialog, or NULL to | 73 // HtmlDialogTabContentsDelegate with the dialog, or NULL to |
| 70 // use the default one. The dialog takes ownership of | 74 // use the default one. The dialog takes ownership of |
| 71 // |tab_delegate|. | 75 // |tab_delegate|. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 ConstrainedHtmlUIDelegate* GetConstrainedDelegate(); | 91 ConstrainedHtmlUIDelegate* GetConstrainedDelegate(); |
| 88 | 92 |
| 89 private: | 93 private: |
| 90 // JS Message Handler | 94 // JS Message Handler |
| 91 void OnDialogCloseMessage(const base::ListValue* args); | 95 void OnDialogCloseMessage(const base::ListValue* args); |
| 92 | 96 |
| 93 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI); | 97 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI); |
| 94 }; | 98 }; |
| 95 | 99 |
| 96 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ | 100 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ |
| OLD | NEW |