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