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

Side by Side Diff: chrome/browser/ui/views/constrained_html_delegate_gtk.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_html_ui.h" 5 #include "chrome/browser/ui/webui/constrained_html_ui.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" 8 #include "chrome/browser/ui/gtk/constrained_window_gtk.h"
9 #include "chrome/browser/ui/gtk/gtk_util.h" 9 #include "chrome/browser/ui/gtk/gtk_util.h"
10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 HtmlDialogUIDelegate* html_delegate_; 63 HtmlDialogUIDelegate* html_delegate_;
64 64
65 // The constrained window that owns |this|. Saved so we can close it later. 65 // The constrained window that owns |this|. Saved so we can close it later.
66 ConstrainedWindow* window_; 66 ConstrainedWindow* window_;
67 }; 67 };
68 68
69 ConstrainedHtmlDelegateGtk::ConstrainedHtmlDelegateGtk( 69 ConstrainedHtmlDelegateGtk::ConstrainedHtmlDelegateGtk(
70 Profile* profile, 70 Profile* profile,
71 HtmlDialogUIDelegate* delegate) 71 HtmlDialogUIDelegate* delegate)
72 : views::WidgetGtk(views::WidgetGtk::TYPE_CHILD), 72 : HtmlDialogTabContentsDelegate(profile),
73 HtmlDialogTabContentsDelegate(profile),
74 html_tab_contents_(profile, NULL, MSG_ROUTING_NONE, NULL, NULL), 73 html_tab_contents_(profile, NULL, MSG_ROUTING_NONE, NULL, NULL),
75 tab_container_(NULL), 74 tab_container_(NULL),
76 html_delegate_(delegate), 75 html_delegate_(delegate),
77 window_(NULL) { 76 window_(NULL) {
78 CHECK(delegate); 77 CHECK(delegate);
79 html_tab_contents_.set_delegate(this); 78 html_tab_contents_.set_delegate(this);
80 79
81 // Set |this| as a property so the ConstrainedHtmlUI can retrieve it. 80 // Set |this| as a property so the ConstrainedHtmlUI can retrieve it.
82 ConstrainedHtmlUI::GetPropertyAccessor().SetProperty( 81 ConstrainedHtmlUI::GetPropertyAccessor().SetProperty(
83 html_tab_contents_.property_bag(), this); 82 html_tab_contents_.property_bag(), this);
84 html_tab_contents_.controller().LoadURL(delegate->GetDialogContentURL(), 83 html_tab_contents_.controller().LoadURL(delegate->GetDialogContentURL(),
85 GURL(), 84 GURL(),
86 PageTransition::START_PAGE); 85 PageTransition::START_PAGE);
87 86
88 Init(NULL, gfx::Rect()); 87 views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_CONTROL);
88 GetWidget()->Init(params);
89 89
90 tab_container_ = new TabContentsContainer; 90 tab_container_ = new TabContentsContainer;
91 SetContentsView(tab_container_); 91 SetContentsView(tab_container_);
92 tab_container_->ChangeTabContents(&html_tab_contents_); 92 tab_container_->ChangeTabContents(&html_tab_contents_);
93 93
94 gfx::Size dialog_size; 94 gfx::Size dialog_size;
95 html_delegate_->GetDialogSize(&dialog_size); 95 html_delegate_->GetDialogSize(&dialog_size);
96 gtk_widget_set_size_request(GetWidgetRoot(), 96 gtk_widget_set_size_request(GetWidgetRoot(),
97 dialog_size.width(), 97 dialog_size.width(),
98 dialog_size.height()); 98 dialog_size.height());
(...skipping 15 matching lines...) Expand all
114 Profile* profile, 114 Profile* profile,
115 HtmlDialogUIDelegate* delegate, 115 HtmlDialogUIDelegate* delegate,
116 TabContents* container) { 116 TabContents* container) {
117 ConstrainedHtmlDelegateGtk* constrained_delegate = 117 ConstrainedHtmlDelegateGtk* constrained_delegate =
118 new ConstrainedHtmlDelegateGtk(profile, delegate); 118 new ConstrainedHtmlDelegateGtk(profile, delegate);
119 ConstrainedWindow* constrained_window = 119 ConstrainedWindow* constrained_window =
120 container->CreateConstrainedDialog(constrained_delegate); 120 container->CreateConstrainedDialog(constrained_delegate);
121 constrained_delegate->set_window(constrained_window); 121 constrained_delegate->set_window(constrained_window);
122 return constrained_window; 122 return constrained_window;
123 } 123 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bubble/bubble.cc ('k') | chrome/browser/ui/views/dom_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698