summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/html_dialog_view.cc
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 04:12:18 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 04:12:18 +0000
commit0f2f4b60511540e292e085ba5e1985be6bf93908 (patch)
tree6d6bb042fe78bb23c4eca3cf4a4222a3dab38e74 /chrome/browser/views/html_dialog_view.cc
parentaaeb9dc745d49afa66c1b613daa5a3123f309955 (diff)
downloadchromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.zip
chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.tar.gz
chromium_src-0f2f4b60511540e292e085ba5e1985be6bf93908.tar.bz2
Window Delegate Improvements:
- Windows now must have a Delegate. Just construct the default WindowDelegate if you don't want to have to write one in testing. - Windows now obtain their contents view by asking the delegate via WindowDelegate::GetContentsView. - Contents views no longer need to manually store a pointer to the Window that contains them, WindowDelegate does this automatically via its window() accessor. Reviewer notes: - review window_delegate.h first, then - window.h/cc - custom frame window.h/cc - constrained_window_impl.h/cc - then everything else (just updating all call sites) B=1280060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/html_dialog_view.cc')
-rw-r--r--chrome/browser/views/html_dialog_view.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc
index 1be835f..cdf48e8 100644
--- a/chrome/browser/views/html_dialog_view.cc
+++ b/chrome/browser/views/html_dialog_view.cc
@@ -39,7 +39,6 @@ HtmlDialogView::HtmlDialogView(Browser* parent_browser,
Profile* profile,
HtmlDialogContentsDelegate* delegate)
: DOMView(delegate->GetDialogContentURL()),
- dialog_(NULL),
parent_browser_(parent_browser),
profile_(profile),
delegate_(delegate) {
@@ -80,6 +79,10 @@ void HtmlDialogView::WindowClosing() {
OnDialogClosed("");
}
+ChromeViews::View* HtmlDialogView::GetContentsView() {
+ return this;
+}
+
////////////////////////////////////////////////////////////////////////////////
// HtmlDialogContentsDelegate implementation:
@@ -98,7 +101,7 @@ std::string HtmlDialogView::GetDialogArgs() const {
void HtmlDialogView::OnDialogClosed(const std::string& json_retval) {
delegate_->OnDialogClosed(json_retval);
delegate_ = NULL; // We will not communicate further with the delegate.
- dialog_->Close();
+ window()->Close();
}
////////////////////////////////////////////////////////////////////////////////
@@ -155,14 +158,14 @@ void HtmlDialogView::MoveContents(TabContents* source, const gfx::Rect& pos) {
// Determine the size the window containing the dialog at its requested size.
gfx::Size window_size =
- dialog_->CalculateWindowSizeForClientSize(pos.size());
+ window()->CalculateWindowSizeForClientSize(pos.size());
// Actually size the window.
CRect vc_bounds;
GetViewContainer()->GetBounds(&vc_bounds, true);
gfx::Rect bounds(vc_bounds.left, vc_bounds.top, window_size.width(),
window_size.height());
- dialog_->SetBounds(bounds);
+ window()->SetBounds(bounds);
}
bool HtmlDialogView::IsPopup(TabContents* source) {
@@ -187,9 +190,7 @@ void HtmlDialogView::UpdateTargetURL(TabContents* source, const GURL& url) {
////////////////////////////////////////////////////////////////////////////////
// HtmlDialogView:
-void HtmlDialogView::InitDialog(ChromeViews::Window* dialog) {
- dialog_ = dialog;
-
+void HtmlDialogView::InitDialog() {
// Now Init the DOMView. This view runs in its own process to render the html.
DOMView::Init(profile_, NULL);