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

Side by Side Diff: ui/web_dialogs/constrained_web_dialog_ui.h

Issue 11358027: Move constrained web dialog code back to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cros fix2 Created 8 years, 1 month 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
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/web_dialogs/constrained_web_dialog_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_
6 #define UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_
7
8 #include "base/compiler_specific.h"
9 #include "content/public/browser/web_ui_controller.h"
10 #include "ui/web_dialogs/web_dialogs_export.h"
11
12 class ConstrainedWindow;
13 class Profile;
14 class TabContents;
15
16 namespace content {
17 class RenderViewHost;
18 class WebContents;
19 }
20
21 namespace ui {
22 class WebDialogDelegate;
23 class WebDialogWebContentsDelegate;
24
25 class WEB_DIALOGS_EXPORT ConstrainedWebDialogDelegate {
26 public:
27 virtual const WebDialogDelegate* GetWebDialogDelegate() const = 0;
28 virtual WebDialogDelegate* GetWebDialogDelegate() = 0;
29
30 // Called when the dialog is being closed in response to a "DialogClose"
31 // message from WebUI.
32 virtual void OnDialogCloseFromWebUI() = 0;
33
34 // If called, on dialog closure, the dialog will release its WebContents
35 // instead of destroying it. After which point, the caller will own the
36 // released WebContents.
37 virtual void ReleaseTabContentsOnDialogClose() = 0;
38
39 // Returns the ConstrainedWindow.
40 // TODO: fix this function name and the one below to conform to the style
41 // guide (i.e. GetWindow, GetTab).
42 virtual ConstrainedWindow* window() = 0;
43
44 // Returns the TabContents owned by the constrained window.
45 virtual TabContents* tab() = 0;
46
47 protected:
48 virtual ~ConstrainedWebDialogDelegate() {}
49 };
50
51 // ConstrainedWebDialogUI is a facility to show HTML WebUI content
52 // in a tab-modal constrained dialog. It is implemented as an adapter
53 // between an WebDialogUI object and a ConstrainedWindow object.
54 //
55 // Since ConstrainedWindow requires platform-specific delegate
56 // implementations, this class is just a factory stub.
57 // TODO(thestig) Refactor the platform-independent code out of the
58 // platform-specific implementations.
59 class WEB_DIALOGS_EXPORT ConstrainedWebDialogUI
60 : public content::WebUIController {
61 public:
62 explicit ConstrainedWebDialogUI(content::WebUI* web_ui);
63 virtual ~ConstrainedWebDialogUI();
64
65 // WebUIController implementation:
66 virtual void RenderViewCreated(
67 content::RenderViewHost* render_view_host) OVERRIDE;
68
69 // Sets the delegate on the WebContents.
70 static void SetConstrainedDelegate(content::WebContents* web_contents,
71 ConstrainedWebDialogDelegate* delegate);
72
73 protected:
74 // Returns the ConstrainedWebDialogDelegate saved with the WebContents.
75 // Returns NULL if no such delegate is set.
76 ConstrainedWebDialogDelegate* GetConstrainedDelegate();
77
78 private:
79 // JS Message Handler
80 void OnDialogCloseMessage(const base::ListValue* args);
81
82 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogUI);
83 };
84
85 // Create a constrained HTML dialog. The actual object that gets created
86 // is a ConstrainedWebDialogDelegate, which later triggers construction of a
87 // ConstrainedWebDialogUI object.
88 // |profile| is used to construct the constrained HTML dialog's WebContents.
89 // |delegate| controls the behavior of the dialog.
90 // |tab_delegate| is optional, pass one in to use a custom
91 // WebDialogWebContentsDelegate with the dialog, or NULL to
92 // use the default one. The dialog takes ownership of
93 // |tab_delegate|.
94 // |overshadowed| is the tab being overshadowed by the dialog.
95 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
96 Profile* profile,
97 WebDialogDelegate* delegate,
98 WebDialogWebContentsDelegate* tab_delegate,
99 TabContents* overshadowed);
100
101 } // namespace ui
102
103 #endif // UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/web_dialogs/constrained_web_dialog_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698