OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/html_dialog_tab_contents_delegate.h" | 5 #include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_window.h" | 8 #include "chrome/browser/browser_window.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 WindowOpenDisposition disposition, PageTransition::Type transition) { | 36 WindowOpenDisposition disposition, PageTransition::Type transition) { |
37 if (profile_) { | 37 if (profile_) { |
38 // Force all links to open in a new window, ignoring the incoming | 38 // Force all links to open in a new window, ignoring the incoming |
39 // disposition. This is a tabless, modal dialog so we can't just | 39 // disposition. This is a tabless, modal dialog so we can't just |
40 // open it in the current frame. Code adapted from | 40 // open it in the current frame. Code adapted from |
41 // Browser::OpenURLFromTab() with disposition == NEW_WINDOW. | 41 // Browser::OpenURLFromTab() with disposition == NEW_WINDOW. |
42 Browser* browser = CreateBrowser(); | 42 Browser* browser = CreateBrowser(); |
43 TabContents* new_contents = | 43 TabContents* new_contents = |
44 browser->AddTabWithURL(url, referrer, transition, -1, | 44 browser->AddTabWithURL(url, referrer, transition, -1, |
45 TabStripModel::ADD_SELECTED, NULL, | 45 TabStripModel::ADD_SELECTED, NULL, |
46 std::string()); | 46 std::string(), &browser); |
47 DCHECK(new_contents); | 47 DCHECK(new_contents); |
48 browser->window()->Show(); | 48 browser->window()->Show(); |
49 new_contents->Focus(); | 49 new_contents->Focus(); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 void HtmlDialogTabContentsDelegate::NavigationStateChanged( | 53 void HtmlDialogTabContentsDelegate::NavigationStateChanged( |
54 const TabContents* source, unsigned changed_flags) { | 54 const TabContents* source, unsigned changed_flags) { |
55 // We shouldn't receive any NavigationStateChanged except the first | 55 // We shouldn't receive any NavigationStateChanged except the first |
56 // one, which we ignore because we're a dialog box. | 56 // one, which we ignore because we're a dialog box. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 void HtmlDialogTabContentsDelegate::UpdateTargetURL(TabContents* source, | 100 void HtmlDialogTabContentsDelegate::UpdateTargetURL(TabContents* source, |
101 const GURL& url) { | 101 const GURL& url) { |
102 // Ignored. | 102 // Ignored. |
103 } | 103 } |
104 | 104 |
105 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory() const { | 105 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory() const { |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
OLD | NEW |