OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/webui/chrome_web_ui.h" | 9 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
10 #include "content/common/property_bag.h" | |
11 | 10 |
12 class ConstrainedWindow; | 11 class ConstrainedWindow; |
13 class HtmlDialogUIDelegate; | 12 class HtmlDialogUIDelegate; |
14 class Profile; | 13 class Profile; |
15 class RenderViewHost; | 14 class RenderViewHost; |
16 class TabContents; | 15 class TabContents; |
17 class TabContentsWrapper; | 16 class TabContentsWrapper; |
18 | 17 |
| 18 namespace base { |
| 19 template<class T> class PropertyAccessor; |
| 20 } |
| 21 |
19 class ConstrainedHtmlUIDelegate { | 22 class ConstrainedHtmlUIDelegate { |
20 public: | 23 public: |
21 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0; | 24 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0; |
22 | 25 |
23 // Called when the dialog is being closed in response to a "DialogClose" | 26 // Called when the dialog is being closed in response to a "DialogClose" |
24 // message from WebUI. | 27 // message from WebUI. |
25 virtual void OnDialogCloseFromWebUI() = 0; | 28 virtual void OnDialogCloseFromWebUI() = 0; |
26 | 29 |
27 // If called, on dialog closure, the dialog will release its TabContents | 30 // If called, on dialog closure, the dialog will release its TabContents |
28 // instead of destroying it. After which point, the caller will own the | 31 // instead of destroying it. After which point, the caller will own the |
(...skipping 26 matching lines...) Expand all Loading... |
55 // Create a constrained HTML dialog. The actual object that gets created | 58 // Create a constrained HTML dialog. The actual object that gets created |
56 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a | 59 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a |
57 // ConstrainedHtmlUI object. | 60 // ConstrainedHtmlUI object. |
58 static ConstrainedHtmlUIDelegate* CreateConstrainedHtmlDialog( | 61 static ConstrainedHtmlUIDelegate* CreateConstrainedHtmlDialog( |
59 Profile* profile, | 62 Profile* profile, |
60 HtmlDialogUIDelegate* delegate, | 63 HtmlDialogUIDelegate* delegate, |
61 TabContentsWrapper* overshadowed); | 64 TabContentsWrapper* overshadowed); |
62 | 65 |
63 // Returns a property accessor that can be used to set the | 66 // Returns a property accessor that can be used to set the |
64 // ConstrainedHtmlUIDelegate property on a TabContents. | 67 // ConstrainedHtmlUIDelegate property on a TabContents. |
65 static PropertyAccessor<ConstrainedHtmlUIDelegate*>& | 68 static base::PropertyAccessor<ConstrainedHtmlUIDelegate*>& |
66 GetPropertyAccessor(); | 69 GetPropertyAccessor(); |
67 | 70 |
68 protected: | 71 protected: |
69 // Returns the TabContents' PropertyBag's ConstrainedHtmlUIDelegate. | 72 // Returns the TabContents' PropertyBag's ConstrainedHtmlUIDelegate. |
70 // Returns NULL if that property is not set. | 73 // Returns NULL if that property is not set. |
71 ConstrainedHtmlUIDelegate* GetConstrainedDelegate(); | 74 ConstrainedHtmlUIDelegate* GetConstrainedDelegate(); |
72 | 75 |
73 private: | 76 private: |
74 // JS Message Handler | 77 // JS Message Handler |
75 void OnDialogCloseMessage(const base::ListValue* args); | 78 void OnDialogCloseMessage(const base::ListValue* args); |
76 | 79 |
77 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI); | 80 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI); |
78 }; | 81 }; |
79 | 82 |
80 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ | 83 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_ |
OLD | NEW |