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_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #if !(defined(USE_AURA) || defined(OS_CHROMEOS)) | 9 #if !(defined(USE_AURA) || defined(OS_CHROMEOS)) |
10 #error Tab-modal confirm dialog should be shown with native UI. | 10 #error Tab-modal confirm dialog should be shown with native UI. |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 15 #include "chrome/browser/ui/webui/web_dialog_ui.h" |
16 | 16 |
17 class ConstrainedHtmlUIDelegate; | 17 class ConstrainedWebDialogDelegate; |
18 class TabContentsWrapper; | 18 class TabContentsWrapper; |
19 class TabModalConfirmDialogDelegate; | 19 class TabModalConfirmDialogDelegate; |
20 | 20 |
21 // Displays a tab-modal dialog, i.e. a dialog that will block the current page | 21 // Displays a tab-modal dialog, i.e. a dialog that will block the current page |
22 // but still allow the user to switch to a different page. | 22 // but still allow the user to switch to a different page. |
23 // To display the dialog, allocate this object on the heap. It will open the | 23 // To display the dialog, allocate this object on the heap. It will open the |
24 // dialog from its constructor and then delete itself when the user dismisses | 24 // dialog from its constructor and then delete itself when the user dismisses |
25 // the dialog. | 25 // the dialog. |
26 class TabModalConfirmDialogWebUI : public HtmlDialogUIDelegate { | 26 class TabModalConfirmDialogWebUI : public WebDialogDelegate { |
27 public: | 27 public: |
28 TabModalConfirmDialogWebUI( | 28 TabModalConfirmDialogWebUI( |
29 TabModalConfirmDialogDelegate* dialog_delegate, | 29 TabModalConfirmDialogDelegate* dialog_delegate, |
30 TabContentsWrapper* wrapper); | 30 TabContentsWrapper* wrapper); |
31 | 31 |
32 // HtmlDialogUIDelegate implementation. | 32 // WebDialogDelegate implementation. |
33 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | 33 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
34 virtual string16 GetDialogTitle() const OVERRIDE; | 34 virtual string16 GetDialogTitle() const OVERRIDE; |
35 virtual GURL GetDialogContentURL() const OVERRIDE; | 35 virtual GURL GetDialogContentURL() const OVERRIDE; |
36 virtual void GetWebUIMessageHandlers( | 36 virtual void GetWebUIMessageHandlers( |
37 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; | 37 std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; |
38 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 38 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
39 virtual std::string GetDialogArgs() const OVERRIDE; | 39 virtual std::string GetDialogArgs() const OVERRIDE; |
40 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 40 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
41 virtual void OnCloseContents(content::WebContents* source, | 41 virtual void OnCloseContents(content::WebContents* source, |
42 bool* out_close_dialog) OVERRIDE; | 42 bool* out_close_dialog) OVERRIDE; |
43 virtual bool ShouldShowDialogTitle() const OVERRIDE; | 43 virtual bool ShouldShowDialogTitle() const OVERRIDE; |
44 | 44 |
45 ConstrainedHtmlUIDelegate* constrained_html_ui_delegate() { | 45 ConstrainedWebDialogDelegate* constrained_web_dialog_delegate() { |
46 return constrained_html_ui_delegate_; | 46 return constrained_web_dialog_delegate_; |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 virtual ~TabModalConfirmDialogWebUI(); | 50 virtual ~TabModalConfirmDialogWebUI(); |
51 | 51 |
52 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; | 52 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; |
53 | 53 |
54 // Deletes itself. | 54 // Deletes itself. |
55 ConstrainedHtmlUIDelegate* constrained_html_ui_delegate_; | 55 ConstrainedWebDialogDelegate* constrained_web_dialog_delegate_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogWebUI); | 57 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogWebUI); |
58 }; | 58 }; |
59 | 59 |
60 #endif // CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ | 60 #endif // CHROME_BROWSER_UI_WEBUI_TAB_MODAL_CONFIRM_DIALOG_WEBUI_H_ |
OLD | NEW |