OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/modal_html_dialog_delegate.h" | 5 #include "chrome/browser/modal_html_dialog_delegate.h" |
6 | 6 |
7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_service.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 bool ModalHtmlDialogDelegate::IsDialogModal() const { | 40 bool ModalHtmlDialogDelegate::IsDialogModal() const { |
41 return true; | 41 return true; |
42 } | 42 } |
43 | 43 |
44 GURL ModalHtmlDialogDelegate::GetDialogContentURL() const { | 44 GURL ModalHtmlDialogDelegate::GetDialogContentURL() const { |
45 return params_.url; | 45 return params_.url; |
46 } | 46 } |
47 | 47 |
48 void ModalHtmlDialogDelegate::GetDialogSize(CSize* size) const { | 48 void ModalHtmlDialogDelegate::GetDialogSize(gfx::Size* size) const { |
49 size->cx = params_.width; | 49 size->set_width(params_.width); |
50 size->cy = params_.height; | 50 size->set_height(params_.height); |
51 } | 51 } |
52 | 52 |
53 std::string ModalHtmlDialogDelegate::GetDialogArgs() const { | 53 std::string ModalHtmlDialogDelegate::GetDialogArgs() const { |
54 return params_.json_input; | 54 return params_.json_input; |
55 } | 55 } |
56 | 56 |
57 void ModalHtmlDialogDelegate::OnDialogClosed(const std::string& json_retval) { | 57 void ModalHtmlDialogDelegate::OnDialogClosed(const std::string& json_retval) { |
58 // Our WebContents may have died before this point. | 58 // Our WebContents may have died before this point. |
59 if (contents_ && contents_->render_view_host()) { | 59 if (contents_ && contents_->render_view_host()) { |
60 contents_->render_view_host()->ModalHTMLDialogClosed(sync_response_, | 60 contents_->render_view_host()->ModalHTMLDialogClosed(sync_response_, |
61 json_retval); | 61 json_retval); |
62 } | 62 } |
63 | 63 |
64 // We are done with this request, so delete us. | 64 // We are done with this request, so delete us. |
65 delete this; | 65 delete this; |
66 } | 66 } |
67 | 67 |
68 void ModalHtmlDialogDelegate::RemoveObserver() { | 68 void ModalHtmlDialogDelegate::RemoveObserver() { |
69 if (!contents_) | 69 if (!contents_) |
70 return; | 70 return; |
71 | 71 |
72 NotificationService::current()->RemoveObserver( | 72 NotificationService::current()->RemoveObserver( |
73 this, | 73 this, |
74 NotificationType::WEB_CONTENTS_DISCONNECTED, | 74 NotificationType::WEB_CONTENTS_DISCONNECTED, |
75 Source<WebContents>(contents_)); | 75 Source<WebContents>(contents_)); |
76 contents_ = NULL; // No longer safe to access. | 76 contents_ = NULL; // No longer safe to access. |
77 } | 77 } |
OLD | NEW |