| 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_WEB_DIALOG_DELEGATE_BASE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 9 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 10 #include "ui/web_dialogs/web_dialog_ui.h" | 10 #include "ui/web_dialogs/web_dialog_ui.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ConstrainedWebDialogDelegateBase | 22 class ConstrainedWebDialogDelegateBase |
| 23 : public ConstrainedWebDialogDelegate, | 23 : public ConstrainedWebDialogDelegate, |
| 24 public ui::WebDialogWebContentsDelegate { | 24 public ui::WebDialogWebContentsDelegate { |
| 25 public: | 25 public: |
| 26 ConstrainedWebDialogDelegateBase( | 26 ConstrainedWebDialogDelegateBase( |
| 27 content::BrowserContext* browser_context, | 27 content::BrowserContext* browser_context, |
| 28 ui::WebDialogDelegate* delegate, | 28 ui::WebDialogDelegate* delegate, |
| 29 WebDialogWebContentsDelegate* tab_delegate); | 29 WebDialogWebContentsDelegate* tab_delegate); |
| 30 virtual ~ConstrainedWebDialogDelegateBase(); | 30 virtual ~ConstrainedWebDialogDelegateBase(); |
| 31 | 31 |
| 32 void set_window(ConstrainedWindow* window); | 32 void set_window(WebContentsModalDialog* window); |
| 33 bool closed_via_webui() const; | 33 bool closed_via_webui() const; |
| 34 | 34 |
| 35 // ConstrainedWebDialogDelegate interface. | 35 // ConstrainedWebDialogDelegate interface. |
| 36 virtual const ui::WebDialogDelegate* | 36 virtual const ui::WebDialogDelegate* |
| 37 GetWebDialogDelegate() const OVERRIDE; | 37 GetWebDialogDelegate() const OVERRIDE; |
| 38 virtual ui::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; | 38 virtual ui::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; |
| 39 virtual void OnDialogCloseFromWebUI() OVERRIDE; | 39 virtual void OnDialogCloseFromWebUI() OVERRIDE; |
| 40 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE; | 40 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE; |
| 41 virtual ConstrainedWindow* GetWindow() OVERRIDE; | 41 virtual WebContentsModalDialog* GetWindow() OVERRIDE; |
| 42 virtual content::WebContents* GetWebContents() OVERRIDE; | 42 virtual content::WebContents* GetWebContents() OVERRIDE; |
| 43 | 43 |
| 44 // WebDialogWebContentsDelegate interface. | 44 // WebDialogWebContentsDelegate interface. |
| 45 virtual void HandleKeyboardEvent( | 45 virtual void HandleKeyboardEvent( |
| 46 content::WebContents* source, | 46 content::WebContents* source, |
| 47 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 47 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 void set_override_tab_delegate( | 50 void set_override_tab_delegate( |
| 51 WebDialogWebContentsDelegate* override_tab_delegate); | 51 WebDialogWebContentsDelegate* override_tab_delegate); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_; | 54 scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_; |
| 55 | 55 |
| 56 // The constrained window that owns |this|. Saved so we can close it later. | 56 // The web contents modal dialog that owns |this|. Saved so we can close it |
| 57 ConstrainedWindow* window_; | 57 // later. |
| 58 WebContentsModalDialog* window_; |
| 58 | 59 |
| 59 // Holds the HTML to display in the constrained dialog. | 60 // Holds the HTML to display in the constrained dialog. |
| 60 scoped_ptr<content::WebContents> web_contents_; | 61 scoped_ptr<content::WebContents> web_contents_; |
| 61 | 62 |
| 62 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s | 63 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s |
| 63 // OnDialogClosed() method has already been called)? | 64 // OnDialogClosed() method has already been called)? |
| 64 bool closed_via_webui_; | 65 bool closed_via_webui_; |
| 65 | 66 |
| 66 // If true, release |web_contents_| on close instead of destroying it. | 67 // If true, release |web_contents_| on close instead of destroying it. |
| 67 bool release_contents_on_close_; | 68 bool release_contents_on_close_; |
| 68 | 69 |
| 69 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; | 70 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; |
| 70 | 71 |
| 71 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); | 72 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ | 75 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
| OLD | NEW |