| 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/views/html_dialog_view.h" | 5 #include "chrome/browser/views/html_dialog_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/views/root_view.h" | 8 #include "chrome/views/root_view.h" |
| 9 #include "chrome/views/window.h" | 9 #include "chrome/views/window.h" |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void HtmlDialogView::OnDialogClosed(const std::string& json_retval) { | 79 void HtmlDialogView::OnDialogClosed(const std::string& json_retval) { |
| 80 delegate_->OnDialogClosed(json_retval); | 80 delegate_->OnDialogClosed(json_retval); |
| 81 delegate_ = NULL; // We will not communicate further with the delegate. | 81 delegate_ = NULL; // We will not communicate further with the delegate. |
| 82 window()->Close(); | 82 window()->Close(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 //////////////////////////////////////////////////////////////////////////////// | 85 //////////////////////////////////////////////////////////////////////////////// |
| 86 // PageNavigator implementation: | 86 // PageNavigator implementation: |
| 87 void HtmlDialogView::OpenURLFromTab(TabContents* source, | 87 void HtmlDialogView::OpenURLFromTab(TabContents* source, |
| 88 const GURL& url, | 88 const GURL& url, |
| 89 const GURL& referrer, |
| 89 WindowOpenDisposition disposition, | 90 WindowOpenDisposition disposition, |
| 90 PageTransition::Type transition) { | 91 PageTransition::Type transition) { |
| 91 // Force all links to open in a new window, ignoring the incoming | 92 // Force all links to open in a new window, ignoring the incoming |
| 92 // disposition. This is a tabless, modal dialog so we can't just | 93 // disposition. This is a tabless, modal dialog so we can't just |
| 93 // open it in the current frame. | 94 // open it in the current frame. |
| 94 parent_browser_->OpenURLFromTab(source, url, NEW_WINDOW, transition); | 95 parent_browser_->OpenURLFromTab(source, url, referrer, NEW_WINDOW, |
| 96 transition); |
| 95 } | 97 } |
| 96 | 98 |
| 97 //////////////////////////////////////////////////////////////////////////////// | 99 //////////////////////////////////////////////////////////////////////////////// |
| 98 // TabContentsDelegate implementation: | 100 // TabContentsDelegate implementation: |
| 99 | 101 |
| 100 void HtmlDialogView::NavigationStateChanged(const TabContents* source, | 102 void HtmlDialogView::NavigationStateChanged(const TabContents* source, |
| 101 unsigned changed_flags) { | 103 unsigned changed_flags) { |
| 102 // We shouldn't receive any NavigationStateChanged except the first | 104 // We shouldn't receive any NavigationStateChanged except the first |
| 103 // one, which we ignore because we're a dialog box. | 105 // one, which we ignore because we're a dialog box. |
| 104 } | 106 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Now Init the DOMView. This view runs in its own process to render the html. | 164 // Now Init the DOMView. This view runs in its own process to render the html. |
| 163 DOMView::Init(profile_, NULL); | 165 DOMView::Init(profile_, NULL); |
| 164 | 166 |
| 165 // Make sure this new TabContents we just created in Init() knows about us. | 167 // Make sure this new TabContents we just created in Init() knows about us. |
| 166 DCHECK(host_->type() == TAB_CONTENTS_HTML_DIALOG); | 168 DCHECK(host_->type() == TAB_CONTENTS_HTML_DIALOG); |
| 167 HtmlDialogContents* host = static_cast<HtmlDialogContents*>(host_); | 169 HtmlDialogContents* host = static_cast<HtmlDialogContents*>(host_); |
| 168 host->Init(this); | 170 host->Init(this); |
| 169 host->set_delegate(this); | 171 host->set_delegate(this); |
| 170 } | 172 } |
| 171 | 173 |
| OLD | NEW |