| 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/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
| 10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 DCHECK(type == NotificationType::TAB_CONTENTS_DISCONNECTED); | 35 DCHECK(type == NotificationType::TAB_CONTENTS_DISCONNECTED); |
| 36 DCHECK(Source<TabContents>(source).ptr() == contents_); | 36 DCHECK(Source<TabContents>(source).ptr() == contents_); |
| 37 registrar_.RemoveAll(); | 37 registrar_.RemoveAll(); |
| 38 contents_ = NULL; | 38 contents_ = NULL; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool ModalHtmlDialogDelegate::IsDialogModal() const { | 41 bool ModalHtmlDialogDelegate::IsDialogModal() const { |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 std::wstring ModalHtmlDialogDelegate::GetDialogTitle() const { |
| 46 return L"Gears"; |
| 47 } |
| 48 |
| 45 GURL ModalHtmlDialogDelegate::GetDialogContentURL() const { | 49 GURL ModalHtmlDialogDelegate::GetDialogContentURL() const { |
| 46 return params_.url; | 50 return params_.url; |
| 47 } | 51 } |
| 48 | 52 |
| 49 void ModalHtmlDialogDelegate::GetDialogSize(gfx::Size* size) const { | 53 void ModalHtmlDialogDelegate::GetDialogSize(gfx::Size* size) const { |
| 50 size->set_width(params_.width); | 54 size->set_width(params_.width); |
| 51 size->set_height(params_.height); | 55 size->set_height(params_.height); |
| 52 } | 56 } |
| 53 | 57 |
| 54 std::string ModalHtmlDialogDelegate::GetDialogArgs() const { | 58 std::string ModalHtmlDialogDelegate::GetDialogArgs() const { |
| 55 return params_.json_input; | 59 return params_.json_input; |
| 56 } | 60 } |
| 57 | 61 |
| 58 void ModalHtmlDialogDelegate::OnDialogClosed(const std::string& json_retval) { | 62 void ModalHtmlDialogDelegate::OnDialogClosed(const std::string& json_retval) { |
| 59 // Our TabContents may have died before this point. | 63 // Our TabContents may have died before this point. |
| 60 if (contents_ && contents_->render_view_host()) { | 64 if (contents_ && contents_->render_view_host()) { |
| 61 contents_->render_view_host()->ModalHTMLDialogClosed(sync_response_, | 65 contents_->render_view_host()->ModalHTMLDialogClosed(sync_response_, |
| 62 json_retval); | 66 json_retval); |
| 63 } | 67 } |
| 64 | 68 |
| 65 // We are done with this request, so delete us. | 69 // We are done with this request, so delete us. |
| 66 delete this; | 70 delete this; |
| 67 } | 71 } |
| OLD | NEW |