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_DELEGATE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_DELEGATE_IMPL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" | 11 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 12 #include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" |
| 13 #include "chrome/browser/ui/webui/web_dialog_ui.h" |
12 | 14 |
13 // Platform-agnostic base implementation of ConstrainedHtmlUIDelegate. | 15 // Platform-agnostic base implementation of ConstrainedWebDialogDelegate. |
14 class ConstrainedHtmlUIDelegateImpl : public ConstrainedHtmlUIDelegate, | 16 class ConstrainedWebDialogDelegateBase |
15 public HtmlDialogTabContentsDelegate { | 17 : public ConstrainedWebDialogDelegate, |
| 18 public WebDialogWebContentsDelegate { |
16 public: | 19 public: |
17 ConstrainedHtmlUIDelegateImpl(Profile* profile, | 20 ConstrainedWebDialogDelegateBase( |
18 HtmlDialogUIDelegate* delegate, | 21 Profile* profile, |
19 HtmlDialogTabContentsDelegate* tab_delegate); | 22 WebDialogDelegate* delegate, |
20 virtual ~ConstrainedHtmlUIDelegateImpl(); | 23 WebDialogWebContentsDelegate* tab_delegate); |
| 24 virtual ~ConstrainedWebDialogDelegateBase(); |
21 | 25 |
22 void set_window(ConstrainedWindow* window); | 26 void set_window(ConstrainedWindow* window); |
23 bool closed_via_webui() const; | 27 bool closed_via_webui() const; |
24 | 28 |
25 // ConstrainedHtmlUIDelegate interface. | 29 // ConstrainedWebDialogDelegate interface. |
26 virtual const HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() const OVERRIDE; | 30 virtual const WebDialogDelegate* |
27 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() OVERRIDE; | 31 GetWebDialogDelegate() const OVERRIDE; |
| 32 virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; |
28 virtual void OnDialogCloseFromWebUI() OVERRIDE; | 33 virtual void OnDialogCloseFromWebUI() OVERRIDE; |
29 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE; | 34 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE; |
30 virtual ConstrainedWindow* window() OVERRIDE; | 35 virtual ConstrainedWindow* window() OVERRIDE; |
31 virtual TabContentsWrapper* tab() OVERRIDE; | 36 virtual TabContentsWrapper* tab() OVERRIDE; |
32 | 37 |
33 // HtmlDialogTabContentsDelegate interface. | 38 // WebDialogWebContentsDelegate interface. |
34 virtual void HandleKeyboardEvent( | 39 virtual void HandleKeyboardEvent( |
35 const NativeWebKeyboardEvent& event) OVERRIDE; | 40 const NativeWebKeyboardEvent& event) OVERRIDE; |
36 | 41 |
37 protected: | 42 protected: |
38 void set_override_tab_delegate( | 43 void set_override_tab_delegate( |
39 HtmlDialogTabContentsDelegate* override_tab_delegate); | 44 WebDialogWebContentsDelegate* override_tab_delegate); |
40 | 45 |
41 private: | 46 private: |
42 HtmlDialogUIDelegate* html_delegate_; | 47 WebDialogDelegate* web_dialog_delegate_; |
43 | 48 |
44 // The constrained window that owns |this|. Saved so we can close it later. | 49 // The constrained window that owns |this|. Saved so we can close it later. |
45 ConstrainedWindow* window_; | 50 ConstrainedWindow* window_; |
46 | 51 |
47 // Holds the HTML to display in the constrained dialog. | 52 // Holds the HTML to display in the constrained dialog. |
48 scoped_ptr<TabContentsWrapper> tab_; | 53 scoped_ptr<TabContentsWrapper> tab_; |
49 | 54 |
50 // Was the dialog closed from WebUI (in which case |html_delegate_|'s | 55 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s |
51 // OnDialogClosed() method has already been called)? | 56 // OnDialogClosed() method has already been called)? |
52 bool closed_via_webui_; | 57 bool closed_via_webui_; |
53 | 58 |
54 // If true, release |tab_| on close instead of destroying it. | 59 // If true, release |tab_| on close instead of destroying it. |
55 bool release_tab_on_close_; | 60 bool release_tab_on_close_; |
56 | 61 |
57 scoped_ptr<HtmlDialogTabContentsDelegate> override_tab_delegate_; | 62 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; |
58 | 63 |
59 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUIDelegateImpl); | 64 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); |
60 }; | 65 }; |
61 | 66 |
62 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_DELEGATE_IMPL_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
OLD | NEW |