Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Side by Side Diff: chrome/browser/ui/webui/constrained_html_ui.h

Issue 10214001: WebDialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_H_
6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "content/public/browser/web_ui_controller.h"
11
12 class ConstrainedWindow;
13 class HtmlDialogTabContentsDelegate;
14 class HtmlDialogUIDelegate;
15 class Profile;
16 class TabContentsWrapper;
17
18 namespace base {
19 template<class T> class PropertyAccessor;
20 }
21
22 namespace content {
23 class RenderViewHost;
24 }
25
26 class ConstrainedHtmlUIDelegate {
27 public:
28 virtual const HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() const = 0;
29 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() = 0;
30
31 // Called when the dialog is being closed in response to a "DialogClose"
32 // message from WebUI.
33 virtual void OnDialogCloseFromWebUI() = 0;
34
35 // If called, on dialog closure, the dialog will release its WebContents
36 // instead of destroying it. After which point, the caller will own the
37 // released WebContents.
38 virtual void ReleaseTabContentsOnDialogClose() = 0;
39
40 // Returns the ConstrainedWindow.
41 virtual ConstrainedWindow* window() = 0;
42
43 // Returns the TabContentsWrapper owned by the constrained window.
44 virtual TabContentsWrapper* tab() = 0;
45
46 protected:
47 virtual ~ConstrainedHtmlUIDelegate() {}
48 };
49
50 // ConstrainedHtmlUI is a facility to show HTML WebUI content
51 // in a tab-modal constrained dialog. It is implemented as an adapter
52 // between an HtmlDialogUI object and a ConstrainedWindow object.
53 //
54 // Since ConstrainedWindow requires platform-specific delegate
55 // implementations, this class is just a factory stub.
56 // TODO(thestig) Refactor the platform-independent code out of the
57 // platform-specific implementations.
58 class ConstrainedHtmlUI : public content::WebUIController {
59 public:
60 explicit ConstrainedHtmlUI(content::WebUI* web_ui);
61 virtual ~ConstrainedHtmlUI();
62
63 // WebUIController implementation:
64 virtual void RenderViewCreated(
65 content::RenderViewHost* render_view_host) OVERRIDE;
66
67 // Create a constrained HTML dialog. The actual object that gets created
68 // is a ConstrainedHtmlUIDelegate, which later triggers construction of a
69 // ConstrainedHtmlUI object.
70 // |profile| is used to construct the constrained HTML dialog's WebContents.
71 // |delegate| controls the behavior of the dialog.
72 // |tab_delegate| is optional, pass one in to use a custom
73 // HtmlDialogTabContentsDelegate with the dialog, or NULL to
74 // use the default one. The dialog takes ownership of
75 // |tab_delegate|.
76 // |overshadowed| is the tab being overshadowed by the dialog.
77 static ConstrainedHtmlUIDelegate* CreateConstrainedHtmlDialog(
78 Profile* profile,
79 HtmlDialogUIDelegate* delegate,
80 HtmlDialogTabContentsDelegate* tab_delegate,
81 TabContentsWrapper* overshadowed);
82
83 // Returns a property accessor that can be used to set the
84 // ConstrainedHtmlUIDelegate property on a WebContents.
85 static base::PropertyAccessor<ConstrainedHtmlUIDelegate*>&
86 GetPropertyAccessor();
87
88 protected:
89 // Returns the WebContents' PropertyBag's ConstrainedHtmlUIDelegate.
90 // Returns NULL if that property is not set.
91 ConstrainedHtmlUIDelegate* GetConstrainedDelegate();
92
93 private:
94 // JS Message Handler
95 void OnDialogCloseMessage(const base::ListValue* args);
96
97 DISALLOW_COPY_AND_ASSIGN(ConstrainedHtmlUI);
98 };
99
100 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_HTML_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/mobile_setup_dialog.cc ('k') | chrome/browser/ui/webui/constrained_html_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698