| 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(WebContentsModalDialog* window); | |
| 33 bool closed_via_webui() const; | 32 bool closed_via_webui() const; |
| 34 | 33 |
| 35 // ConstrainedWebDialogDelegate interface. | 34 // ConstrainedWebDialogDelegate interface. |
| 36 virtual const ui::WebDialogDelegate* | 35 virtual const ui::WebDialogDelegate* |
| 37 GetWebDialogDelegate() const OVERRIDE; | 36 GetWebDialogDelegate() const OVERRIDE; |
| 38 virtual ui::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; | 37 virtual ui::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; |
| 39 virtual void OnDialogCloseFromWebUI() OVERRIDE; | 38 virtual void OnDialogCloseFromWebUI() OVERRIDE; |
| 40 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE; | 39 virtual void ReleaseWebContentsOnDialogClose() OVERRIDE; |
| 41 virtual WebContentsModalDialog* GetWindow() OVERRIDE; | 40 virtual NativeWebContentsModalDialog GetNativeDialog() OVERRIDE; |
| 42 virtual content::WebContents* GetWebContents() OVERRIDE; | 41 virtual content::WebContents* GetWebContents() OVERRIDE; |
| 43 | 42 |
| 44 // WebDialogWebContentsDelegate interface. | 43 // WebDialogWebContentsDelegate interface. |
| 45 virtual void HandleKeyboardEvent( | 44 virtual void HandleKeyboardEvent( |
| 46 content::WebContents* source, | 45 content::WebContents* source, |
| 47 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 46 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_; | 49 scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_; |
| 51 | 50 |
| 52 // The web contents modal dialog that owns |this|. Saved so we can close it | |
| 53 // later. | |
| 54 WebContentsModalDialog* window_; | |
| 55 | |
| 56 // Holds the HTML to display in the constrained dialog. | 51 // Holds the HTML to display in the constrained dialog. |
| 57 scoped_ptr<content::WebContents> web_contents_; | 52 scoped_ptr<content::WebContents> web_contents_; |
| 58 | 53 |
| 59 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s | 54 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s |
| 60 // OnDialogClosed() method has already been called)? | 55 // OnDialogClosed() method has already been called)? |
| 61 bool closed_via_webui_; | 56 bool closed_via_webui_; |
| 62 | 57 |
| 63 // If true, release |web_contents_| on close instead of destroying it. | 58 // If true, release |web_contents_| on close instead of destroying it. |
| 64 bool release_contents_on_close_; | 59 bool release_contents_on_close_; |
| 65 | 60 |
| 66 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; | 61 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; |
| 67 | 62 |
| 68 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); | 63 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); |
| 69 }; | 64 }; |
| 70 | 65 |
| 71 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ | 66 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |
| OLD | NEW |