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

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

Issue 754953002: Enable AutoResize for Constrained Web Dialogs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
OLDNEW
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_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "components/web_modal/native_web_contents_modal_dialog.h" 9 #include "components/web_modal/native_web_contents_modal_dialog.h"
10 #include "content/public/browser/web_ui_controller.h" 10 #include "content/public/browser/web_ui_controller.h"
11 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 12
13 namespace gfx {
14 class Size;
15 }
16
13 namespace content { 17 namespace content {
14 class BrowserContext; 18 class BrowserContext;
15 class RenderViewHost; 19 class RenderViewHost;
16 class WebContents; 20 class WebContents;
17 } 21 }
18 22
19 namespace ui { 23 namespace ui {
20 class WebDialogDelegate; 24 class WebDialogDelegate;
21 class WebDialogWebContentsDelegate; 25 class WebDialogWebContentsDelegate;
22 } 26 }
(...skipping 11 matching lines...) Expand all
34 // instead of destroying it. After which point, the caller will own the 38 // instead of destroying it. After which point, the caller will own the
35 // released WebContents. 39 // released WebContents.
36 virtual void ReleaseWebContentsOnDialogClose() = 0; 40 virtual void ReleaseWebContentsOnDialogClose() = 0;
37 41
38 // Returns the WebContents owned by the constrained window. 42 // Returns the WebContents owned by the constrained window.
39 virtual content::WebContents* GetWebContents() = 0; 43 virtual content::WebContents* GetWebContents() = 0;
40 44
41 // Returns the native type used to display the dialog. 45 // Returns the native type used to display the dialog.
42 virtual web_modal::NativeWebContentsModalDialog GetNativeDialog() = 0; 46 virtual web_modal::NativeWebContentsModalDialog GetNativeDialog() = 0;
43 47
48 // Returns the minimum size for the dialog.
49 virtual gfx::Size GetMinimumSize() const = 0;
50
51 // Returns the maximum size for the dialog.
52 virtual gfx::Size GetMaximumSize() const = 0;
53
54 virtual gfx::Size GetPreferredSize() const = 0;
55
44 protected: 56 protected:
45 virtual ~ConstrainedWebDialogDelegate() {} 57 virtual ~ConstrainedWebDialogDelegate() {}
46 }; 58 };
47 59
48 // ConstrainedWebDialogUI is a facility to show HTML WebUI content 60 // ConstrainedWebDialogUI is a facility to show HTML WebUI content
49 // in a tab-modal constrained dialog. It is implemented as an adapter 61 // in a tab-modal constrained dialog. It is implemented as an adapter
50 // between an WebDialogUI object and a web contents modal dialog. 62 // between an WebDialogUI object and a web contents modal dialog.
51 // 63 //
52 // Since the web contents modal dialog requires platform-specific delegate 64 // Since the web contents modal dialog requires platform-specific delegate
53 // implementations, this class is just a factory stub. 65 // implementations, this class is just a factory stub.
(...skipping 14 matching lines...) Expand all
68 // Returns NULL if no such delegate is set. 80 // Returns NULL if no such delegate is set.
69 ConstrainedWebDialogDelegate* GetConstrainedDelegate(); 81 ConstrainedWebDialogDelegate* GetConstrainedDelegate();
70 82
71 private: 83 private:
72 // JS Message Handler 84 // JS Message Handler
73 void OnDialogCloseMessage(const base::ListValue* args); 85 void OnDialogCloseMessage(const base::ListValue* args);
74 86
75 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogUI); 87 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogUI);
76 }; 88 };
77 89
78 // Create a constrained HTML dialog. The actual object that gets created 90 // Create and show a constrained HTML dialog. The actual object that gets
79 // is a ConstrainedWebDialogDelegate, which later triggers construction of a 91 // created is a ConstrainedWebDialogDelegate, which later triggers construction
80 // ConstrainedWebDialogUI object. 92 // of a ConstrainedWebDialogUI object.
81 // |browser_context| is used to construct the constrained HTML dialog's 93 // |browser_context| is used to construct the constrained HTML dialog's
82 // WebContents. 94 // WebContents.
83 // |delegate| controls the behavior of the dialog. 95 // |delegate| controls the behavior of the dialog.
84 // |overshadowed| is the tab being overshadowed by the dialog. 96 // |overshadowed| is the tab being overshadowed by the dialog.
85 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( 97 ConstrainedWebDialogDelegate* ShowConstrainedWebDialog(
86 content::BrowserContext* browser_context, 98 content::BrowserContext* browser_context,
87 ui::WebDialogDelegate* delegate, 99 ui::WebDialogDelegate* delegate,
88 content::WebContents* overshadowed); 100 content::WebContents* overshadowed);
89 101
102 // Create and show a constrained HTML dialog with auto-resize enabled. The
103 // dialog is shown automatically with a call to PopupManager->ShowModalDialog()
104 // after document load has completed to avoid UI jankiness.
105 // |browser_context| is used to construct the dialog's WebContents.
106 // |delegate| controls the behavior of the dialog.
107 // |overshadowed| is the tab being overshadowed by the dialog.
108 // |min_size| is the minimum size of the dialog.
109 // |max_size| is the maximum size of the dialog.
110 ConstrainedWebDialogDelegate* ShowConstrainedWebDialogWithAutoResize(
111 content::BrowserContext* browser_context,
112 ui::WebDialogDelegate* delegate,
113 content::WebContents* overshadowed,
114 const gfx::Size& min_size,
115 const gfx::Size& max_size);
116
90 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ 117 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698