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

Side by Side Diff: chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc

Issue 11280270: Remove TabContentsContainerGtk from ConstrainedWebDialogDelegateGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h" 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h"
6 6
7 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" 7 #include "chrome/browser/ui/gtk/constrained_window_gtk.h"
8 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h" 8 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "content/public/browser/notification_source.h" 9 #include "content/public/browser/notification_source.h"
11 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_view.h"
13 #include "ui/base/gtk/gtk_hig_constants.h" 13 #include "ui/base/gtk/gtk_hig_constants.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/web_dialogs/web_dialog_delegate.h" 15 #include "ui/web_dialogs/web_dialog_delegate.h"
16 #include "ui/web_dialogs/web_dialog_ui.h" 16 #include "ui/web_dialogs/web_dialog_ui.h"
17 17
18 using content::WebContents; 18 using content::WebContents;
19 using ui::WebDialogDelegate; 19 using ui::WebDialogDelegate;
20 using ui::WebDialogWebContentsDelegate; 20 using ui::WebDialogWebContentsDelegate;
21 21
22 class ConstrainedWebDialogDelegateGtk : public ConstrainedWindowGtkDelegate, 22 class ConstrainedWebDialogDelegateGtk : public ConstrainedWindowGtkDelegate,
(...skipping 26 matching lines...) Expand all
49 } 49 }
50 virtual ConstrainedWindow* window() OVERRIDE { 50 virtual ConstrainedWindow* window() OVERRIDE {
51 return impl_->window(); 51 return impl_->window();
52 } 52 }
53 virtual TabContents* tab() OVERRIDE { 53 virtual TabContents* tab() OVERRIDE {
54 return impl_->tab(); 54 return impl_->tab();
55 } 55 }
56 56
57 // ConstrainedWindowGtkDelegate interface 57 // ConstrainedWindowGtkDelegate interface
58 virtual GtkWidget* GetWidgetRoot() OVERRIDE { 58 virtual GtkWidget* GetWidgetRoot() OVERRIDE {
59 return tab_contents_container_.widget(); 59 return tab()->web_contents()->GetView()->GetNativeView();
60 } 60 }
61 virtual GtkWidget* GetFocusWidget() OVERRIDE { 61 virtual GtkWidget* GetFocusWidget() OVERRIDE {
62 return tab()->web_contents()->GetContentNativeView(); 62 return tab()->web_contents()->GetContentNativeView();
63 } 63 }
64 virtual void DeleteDelegate() OVERRIDE { 64 virtual void DeleteDelegate() OVERRIDE {
65 if (!impl_->closed_via_webui()) 65 if (!impl_->closed_via_webui())
66 GetWebDialogDelegate()->OnDialogClosed(""); 66 GetWebDialogDelegate()->OnDialogClosed("");
67 delete this; 67 delete this;
68 } 68 }
69 virtual bool GetBackgroundColor(GdkColor* color) OVERRIDE { 69 virtual bool GetBackgroundColor(GdkColor* color) OVERRIDE {
70 *color = ui::kGdkWhite; 70 *color = ui::kGdkWhite;
71 return true; 71 return true;
72 } 72 }
73 73
74 private: 74 private:
75 scoped_ptr<ConstrainedWebDialogDelegateBase> impl_; 75 scoped_ptr<ConstrainedWebDialogDelegateBase> impl_;
76 76
77 TabContentsContainerGtk tab_contents_container_;
78
79 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateGtk); 77 DISALLOW_COPY_AND_ASSIGN(ConstrainedWebDialogDelegateGtk);
80 }; 78 };
81 79
82 ConstrainedWebDialogDelegateGtk::ConstrainedWebDialogDelegateGtk( 80 ConstrainedWebDialogDelegateGtk::ConstrainedWebDialogDelegateGtk(
83 Profile* profile, 81 Profile* profile,
84 WebDialogDelegate* delegate, 82 WebDialogDelegate* delegate,
85 WebDialogWebContentsDelegate* tab_delegate) 83 WebDialogWebContentsDelegate* tab_delegate)
86 : impl_(new ConstrainedWebDialogDelegateBase(profile, delegate, tab_delegate )), 84 : impl_(new ConstrainedWebDialogDelegateBase(
87 tab_contents_container_(NULL) { 85 profile, delegate, tab_delegate)) {
88 tab_contents_container_.SetTab(tab());
89
90 gfx::Size dialog_size; 86 gfx::Size dialog_size;
91 delegate->GetDialogSize(&dialog_size); 87 delegate->GetDialogSize(&dialog_size);
92 gtk_widget_set_size_request(GTK_WIDGET(tab_contents_container_.widget()), 88 gtk_widget_set_size_request(GTK_WIDGET(GetWidgetRoot()),
93 dialog_size.width(), 89 dialog_size.width(),
94 dialog_size.height()); 90 dialog_size.height());
95 91
96 gtk_widget_show_all(GetWidgetRoot()); 92 gtk_widget_show_all(GetWidgetRoot());
97 } 93 }
98 94
99 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( 95 ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
100 Profile* profile, 96 Profile* profile,
101 WebDialogDelegate* delegate, 97 WebDialogDelegate* delegate,
102 WebDialogWebContentsDelegate* tab_delegate, 98 WebDialogWebContentsDelegate* tab_delegate,
103 content::WebContents* web_contents) { 99 content::WebContents* web_contents) {
104 ConstrainedWebDialogDelegateGtk* constrained_delegate = 100 ConstrainedWebDialogDelegateGtk* constrained_delegate =
105 new ConstrainedWebDialogDelegateGtk(profile, delegate, tab_delegate); 101 new ConstrainedWebDialogDelegateGtk(profile, delegate, tab_delegate);
106 ConstrainedWindow* constrained_window = 102 ConstrainedWindow* constrained_window =
107 new ConstrainedWindowGtk(web_contents, constrained_delegate); 103 new ConstrainedWindowGtk(web_contents, constrained_delegate);
108 constrained_delegate->set_window(constrained_window); 104 constrained_delegate->set_window(constrained_window);
109 return constrained_delegate; 105 return constrained_delegate;
110 } 106 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698