diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 21:56:55 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 21:56:55 +0000 |
commit | 5835871a6f47c28ff022c9284e2aa1f0d1761ab3 (patch) | |
tree | 52eba6e7556400aa0b519216907844110bc8ce8a /chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h | |
parent | bc6d23dc0d55aeda0be5ae9d799046ff6a43db14 (diff) | |
download | chromium_src-5835871a6f47c28ff022c9284e2aa1f0d1761ab3.zip chromium_src-5835871a6f47c28ff022c9284e2aa1f0d1761ab3.tar.gz chromium_src-5835871a6f47c28ff022c9284e2aa1f0d1761ab3.tar.bz2 |
Web-ify a bunch of these names. I am going to move some of the framework code here down to ui/web_dialogs in a future cl, hence the namespaces.
HtmlDialogUI->WebDialogUI
HtmlDialogUIDelegate->WebDialogDelegate
HtmlDialogTabContentsDelegate->WebDialogWebContentsDelegate
HtmlDialogView->WebDialogView
HtmlDialogController->WebDialogController
HtmlDialogGtk -> WebDialogGtk
BUG=none
TEST=none
TBR=sky
Review URL: https://chromiumcodereview.appspot.com/10214001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h')
-rw-r--r-- | chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h new file mode 100644 index 0000000..7855bbc --- /dev/null +++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h @@ -0,0 +1,67 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ +#define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ +#pragma once + +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" +#include "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" +#include "chrome/browser/ui/webui/web_dialog_ui.h" + +// Platform-agnostic base implementation of ConstrainedWebDialogDelegate. +class ConstrainedWebDialogDelegateBase + : public ConstrainedWebDialogDelegate, + public WebDialogWebContentsDelegate { + public: + ConstrainedWebDialogDelegateBase( + Profile* profile, + WebDialogDelegate* delegate, + WebDialogWebContentsDelegate* tab_delegate); + virtual ~ConstrainedWebDialogDelegateBase(); + + void set_window(ConstrainedWindow* window); + bool closed_via_webui() const; + + // ConstrainedWebDialogDelegate interface. + virtual const WebDialogDelegate* + GetWebDialogDelegate() const OVERRIDE; + virtual WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; + virtual void OnDialogCloseFromWebUI() OVERRIDE; + virtual void ReleaseTabContentsOnDialogClose() OVERRIDE; + virtual ConstrainedWindow* window() OVERRIDE; + virtual TabContentsWrapper* tab() OVERRIDE; + + // WebDialogWebContentsDelegate interface. + virtual void HandleKeyboardEvent( + const NativeWebKeyboardEvent& event) OVERRIDE; + + protected: + void set_override_tab_delegate( + WebDialogWebContentsDelegate* override_tab_delegate); + + private: + WebDialogDelegate* web_dialog_delegate_; + + // The constrained window that owns |this|. Saved so we can close it later. + ConstrainedWindow* window_; + + // Holds the HTML to display in the constrained dialog. + scoped_ptr<TabContentsWrapper> tab_; + + // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s + // OnDialogClosed() method has already been called)? + bool closed_via_webui_; + + // If true, release |tab_| on close instead of destroying it. + bool release_tab_on_close_; + + scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; + + DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); +}; + +#endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ |