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

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

Issue 1674063002: Revert of [Reland] Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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_DELEGATE_BASE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_
6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" 10 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
11 #include "ui/web_dialogs/web_dialog_ui.h" 11 #include "ui/web_dialogs/web_dialog_ui.h"
12 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" 12 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h"
13 13
14 namespace content { 14 namespace content {
15 class BrowserContext; 15 class BrowserContext;
16 } 16 }
17 17
18 namespace ui { 18 namespace ui {
19 class WebDialogDelegate; 19 class WebDialogDelegate;
20 } 20 }
21 21
22 // Platform-agnostic base implementation of ConstrainedWebDialogDelegate. 22 // Platform-agnostic base implementation of ConstrainedWebDialogDelegate.
23 class ConstrainedWebDialogDelegateBase 23 class ConstrainedWebDialogDelegateBase
24 : public ConstrainedWebDialogDelegate, 24 : public ConstrainedWebDialogDelegate,
25 public ui::WebDialogWebContentsDelegate { 25 public ui::WebDialogWebContentsDelegate {
26 public: 26 public:
27 // |browser_context| and |delegate| must outlive |this| instance, whereas
28 // |this| will take ownership of |tab_delegate|.
29 ConstrainedWebDialogDelegateBase(content::BrowserContext* browser_context, 27 ConstrainedWebDialogDelegateBase(content::BrowserContext* browser_context,
30 ui::WebDialogDelegate* delegate, 28 ui::WebDialogDelegate* delegate,
31 WebDialogWebContentsDelegate* tab_delegate); 29 WebDialogWebContentsDelegate* tab_delegate);
32 ~ConstrainedWebDialogDelegateBase() override; 30 ~ConstrainedWebDialogDelegateBase() override;
33 31
34 bool closed_via_webui() const; 32 bool closed_via_webui() const;
35 33
36 // ConstrainedWebDialogDelegate interface. 34 // ConstrainedWebDialogDelegate interface.
37 const ui::WebDialogDelegate* GetWebDialogDelegate() const override; 35 const ui::WebDialogDelegate* GetWebDialogDelegate() const override;
38 ui::WebDialogDelegate* GetWebDialogDelegate() override; 36 ui::WebDialogDelegate* GetWebDialogDelegate() override;
39 void OnDialogCloseFromWebUI() override; 37 void OnDialogCloseFromWebUI() override;
40 void ReleaseWebContentsOnDialogClose() override; 38 void ReleaseWebContentsOnDialogClose() override;
41 content::WebContents* GetWebContents() override; 39 content::WebContents* GetWebContents() override;
42 gfx::NativeWindow GetNativeDialog() override; 40 gfx::NativeWindow GetNativeDialog() override;
43 gfx::Size GetMinimumSize() const override; 41 gfx::Size GetMinimumSize() const override;
44 gfx::Size GetMaximumSize() const override; 42 gfx::Size GetMaximumSize() const override;
45 gfx::Size GetPreferredSize() const override; 43 gfx::Size GetPreferredSize() const override;
46 44
47 // WebDialogWebContentsDelegate interface. 45 // WebDialogWebContentsDelegate interface.
48 void HandleKeyboardEvent( 46 void HandleKeyboardEvent(
49 content::WebContents* source, 47 content::WebContents* source,
50 const content::NativeWebKeyboardEvent& event) override; 48 const content::NativeWebKeyboardEvent& event) override;
51 49
52 // Resize the dialog to the given size.
53 virtual void ResizeToGivenSize(const gfx::Size size);
54
55 private: 50 private:
56 scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_; 51 scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_;
57 52
58 // Holds the HTML to display in the constrained dialog. 53 // Holds the HTML to display in the constrained dialog.
59 scoped_ptr<content::WebContents> web_contents_; 54 scoped_ptr<content::WebContents> web_contents_;
60 55
61 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s 56 // Was the dialog closed from WebUI (in which case |web_dialog_delegate_|'s
62 // OnDialogClosed() method has already been called)? 57 // OnDialogClosed() method has already been called)?
63 bool closed_via_webui_; 58 bool closed_via_webui_;
64 59
65 // If true, release |web_contents_| on close instead of destroying it. 60 // If true, release |web_contents_| on close instead of destroying it.
66 bool release_contents_on_close_; 61 bool release_contents_on_close_;
67 62
68 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_; 63 scoped_ptr<WebDialogWebContentsDelegate> override_tab_delegate_;
69 64
70 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase); 65 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateBase);
71 }; 66 };
72 67
73 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_ 68 #endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_DELEGATE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698