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/profile.h" | 7 #include "chrome/browser/profile.h" |
8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
| 9 #include "chrome/browser/tab_contents_wrapper.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_navigator.h" | 12 #include "chrome/browser/ui/browser_navigator.h" |
12 | 13 |
13 // Incognito profiles are not long-lived, so we always want to store a | 14 // Incognito profiles are not long-lived, so we always want to store a |
14 // non-incognito profile. | 15 // non-incognito profile. |
15 // | 16 // |
16 // TODO(akalin): Should we make it so that we have a default incognito | 17 // TODO(akalin): Should we make it so that we have a default incognito |
17 // profile that's long-lived? Of course, we'd still have to clear it out | 18 // profile that's long-lived? Of course, we'd still have to clear it out |
18 // when all incognito browsers close. | 19 // when all incognito browsers close. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 51 } |
51 | 52 |
52 void HtmlDialogTabContentsDelegate::AddNewContents( | 53 void HtmlDialogTabContentsDelegate::AddNewContents( |
53 TabContents* source, TabContents* new_contents, | 54 TabContents* source, TabContents* new_contents, |
54 WindowOpenDisposition disposition, const gfx::Rect& initial_pos, | 55 WindowOpenDisposition disposition, const gfx::Rect& initial_pos, |
55 bool user_gesture) { | 56 bool user_gesture) { |
56 if (profile_) { | 57 if (profile_) { |
57 // Specify a NULL browser for navigation. This will cause Navigate() | 58 // Specify a NULL browser for navigation. This will cause Navigate() |
58 // to find a browser matching params.profile or create a new one. | 59 // to find a browser matching params.profile or create a new one. |
59 Browser* browser = NULL; | 60 Browser* browser = NULL; |
60 browser::NavigateParams params(browser, new_contents); | 61 |
| 62 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); |
| 63 browser::NavigateParams params(browser, wrapper); |
61 params.profile = profile_; | 64 params.profile = profile_; |
62 params.source_contents = source; | 65 // TODO(pinkerton): no way to get a wrapper for this. |
| 66 // params.source_contents = source; |
63 params.disposition = disposition; | 67 params.disposition = disposition; |
64 params.window_bounds = initial_pos; | 68 params.window_bounds = initial_pos; |
65 params.show_window = true; | 69 params.show_window = true; |
66 browser::Navigate(¶ms); | 70 browser::Navigate(¶ms); |
67 } | 71 } |
68 } | 72 } |
69 | 73 |
70 void HtmlDialogTabContentsDelegate::ActivateContents(TabContents* contents) { | 74 void HtmlDialogTabContentsDelegate::ActivateContents(TabContents* contents) { |
71 // We don't do anything here because there's only one TabContents in | 75 // We don't do anything here because there's only one TabContents in |
72 // this frame and we don't have a TabStripModel. | 76 // this frame and we don't have a TabStripModel. |
(...skipping 28 matching lines...) Expand all Loading... |
101 void HtmlDialogTabContentsDelegate::UpdateTargetURL(TabContents* source, | 105 void HtmlDialogTabContentsDelegate::UpdateTargetURL(TabContents* source, |
102 const GURL& url) { | 106 const GURL& url) { |
103 // Ignored. | 107 // Ignored. |
104 } | 108 } |
105 | 109 |
106 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( | 110 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( |
107 const history::HistoryAddPageArgs& add_page_args, | 111 const history::HistoryAddPageArgs& add_page_args, |
108 NavigationType::Type navigation_type) { | 112 NavigationType::Type navigation_type) { |
109 return false; | 113 return false; |
110 } | 114 } |
OLD | NEW |