diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 00:34:25 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-19 00:34:25 +0000 |
commit | 2f69b38816cc86ffff8c255a6984376e2aa02c10 (patch) | |
tree | f02519424110456ccda1563e9bee6e32aa78fc56 /chrome/browser/webui/constrained_html_ui.h | |
parent | 7b398be3d0a34cb44dff6c45a6842f4ab4c1116e (diff) | |
download | chromium_src-2f69b38816cc86ffff8c255a6984376e2aa02c10.zip chromium_src-2f69b38816cc86ffff8c255a6984376e2aa02c10.tar.gz chromium_src-2f69b38816cc86ffff8c255a6984376e2aa02c10.tar.bz2 |
Reland "WebUI: Move more files from chrome/browser/dom_ui to chrome/browser/webui. Part 5."
This reverts commit 1088003ee7026f2b830d2451f79ce772c44a7cea.
BUG=59945, 59946
TEST=trybots
TBR=avi@chromium.org
Original Review: http://codereview.chromium.org/6538053/
Review URL: http://codereview.chromium.org/6532069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webui/constrained_html_ui.h')
-rw-r--r-- | chrome/browser/webui/constrained_html_ui.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/chrome/browser/webui/constrained_html_ui.h b/chrome/browser/webui/constrained_html_ui.h new file mode 100644 index 0000000..6c20280 --- /dev/null +++ b/chrome/browser/webui/constrained_html_ui.h @@ -0,0 +1,64 @@ +// Copyright (c) 2011 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_WEBUI_CONSTRAINED_HTML_UI_H_ +#define CHROME_BROWSER_WEBUI_CONSTRAINED_HTML_UI_H_ +#pragma once + +#include <vector> + +#include "chrome/browser/tab_contents/constrained_window.h" +#include "chrome/browser/webui/web_ui.h" +#include "chrome/common/property_bag.h" + +class HtmlDialogUIDelegate; +class Profile; +class RenderViewHost; +class TabContents; + +class ConstrainedHtmlUIDelegate { + public: + virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0; + + // Called when the dialog should close. + virtual void OnDialogClose() = 0; +}; + +// ConstrainedHtmlUI is a facility to show HTML WebUI content +// in a tab-modal constrained dialog. It is implemented as an adapter +// between an HtmlDialogUI object and a ConstrainedWindow object. +// +// Since ConstrainedWindow requires platform-specific delegate +// implementations, this class is just a factory stub. +class ConstrainedHtmlUI : public WebUI { + public: + explicit ConstrainedHtmlUI(TabContents* contents); + virtual ~ConstrainedHtmlUI(); + + virtual void RenderViewCreated(RenderViewHost* render_view_host); + + // Create a constrained HTML dialog. The actual object that gets created + // is a ConstrainedHtmlUIDelegate, which later triggers construction of a + // ConstrainedHtmlUI object. + static void CreateConstrainedHtmlDialog(Profile* profile, + HtmlDialogUIDelegate* delegate, + TabContents* overshadowed); + + // Returns a property accessor that can be used to set the + // ConstrainedHtmlUIDelegate property on a TabContents. + static PropertyAccessor<ConstrainedHtmlUIDelegate*>& + GetPropertyAccessor(); + + private: + // Returns the TabContents' PropertyBag's ConstrainedHtmlUIDelegate. + // Returns NULL if that property is not set. + ConstrainedHtmlUIDelegate* GetConstrainedDelegate(); + + // JS Message Handler + void OnDialogClose(const ListValue* args); + + DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI); +}; + +#endif // CHROME_BROWSER_WEBUI_CONSTRAINED_HTML_UI_H_ |