| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/html_dialog_tab_contents_delegate.h" | 5 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 Browser* browser = NULL; | 37 Browser* browser = NULL; |
| 38 browser::NavigateParams params(browser, url, transition); | 38 browser::NavigateParams params(browser, url, transition); |
| 39 params.profile = profile_; | 39 params.profile = profile_; |
| 40 params.referrer = referrer; | 40 params.referrer = referrer; |
| 41 if (source && source->is_crashed() && disposition == CURRENT_TAB && | 41 if (source && source->is_crashed() && disposition == CURRENT_TAB && |
| 42 transition == PageTransition::LINK) | 42 transition == PageTransition::LINK) |
| 43 params.disposition = NEW_FOREGROUND_TAB; | 43 params.disposition = NEW_FOREGROUND_TAB; |
| 44 else | 44 else |
| 45 params.disposition = disposition; | 45 params.disposition = disposition; |
| 46 params.window_action = browser::NavigateParams::SHOW_WINDOW; | 46 params.window_action = browser::NavigateParams::SHOW_WINDOW; |
| 47 params.user_gesture = true; |
| 47 browser::Navigate(¶ms); | 48 browser::Navigate(¶ms); |
| 48 } | 49 } |
| 49 } | 50 } |
| 50 | 51 |
| 51 void HtmlDialogTabContentsDelegate::NavigationStateChanged( | 52 void HtmlDialogTabContentsDelegate::NavigationStateChanged( |
| 52 const TabContents* source, unsigned changed_flags) { | 53 const TabContents* source, unsigned changed_flags) { |
| 53 // We shouldn't receive any NavigationStateChanged except the first | 54 // We shouldn't receive any NavigationStateChanged except the first |
| 54 // one, which we ignore because we're a dialog box. | 55 // one, which we ignore because we're a dialog box. |
| 55 } | 56 } |
| 56 | 57 |
| 57 void HtmlDialogTabContentsDelegate::AddNewContents( | 58 void HtmlDialogTabContentsDelegate::AddNewContents( |
| 58 TabContents* source, TabContents* new_contents, | 59 TabContents* source, TabContents* new_contents, |
| 59 WindowOpenDisposition disposition, const gfx::Rect& initial_pos, | 60 WindowOpenDisposition disposition, const gfx::Rect& initial_pos, |
| 60 bool user_gesture) { | 61 bool user_gesture) { |
| 61 if (profile_) { | 62 if (profile_) { |
| 62 // Specify a NULL browser for navigation. This will cause Navigate() | 63 // Specify a NULL browser for navigation. This will cause Navigate() |
| 63 // to find a browser matching params.profile or create a new one. | 64 // to find a browser matching params.profile or create a new one. |
| 64 Browser* browser = NULL; | 65 Browser* browser = NULL; |
| 65 | 66 |
| 66 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); | 67 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); |
| 67 browser::NavigateParams params(browser, wrapper); | 68 browser::NavigateParams params(browser, wrapper); |
| 68 params.profile = profile_; | 69 params.profile = profile_; |
| 69 // TODO(pinkerton): no way to get a wrapper for this. | 70 // TODO(pinkerton): no way to get a wrapper for this. |
| 70 // params.source_contents = source; | 71 // params.source_contents = source; |
| 71 params.disposition = disposition; | 72 params.disposition = disposition; |
| 72 params.window_bounds = initial_pos; | 73 params.window_bounds = initial_pos; |
| 73 params.window_action = browser::NavigateParams::SHOW_WINDOW; | 74 params.window_action = browser::NavigateParams::SHOW_WINDOW; |
| 75 params.user_gesture = true; |
| 74 browser::Navigate(¶ms); | 76 browser::Navigate(¶ms); |
| 75 } | 77 } |
| 76 } | 78 } |
| 77 | 79 |
| 78 void HtmlDialogTabContentsDelegate::ActivateContents(TabContents* contents) { | 80 void HtmlDialogTabContentsDelegate::ActivateContents(TabContents* contents) { |
| 79 // We don't do anything here because there's only one TabContents in | 81 // We don't do anything here because there's only one TabContents in |
| 80 // this frame and we don't have a TabStripModel. | 82 // this frame and we don't have a TabStripModel. |
| 81 } | 83 } |
| 82 | 84 |
| 83 void HtmlDialogTabContentsDelegate::DeactivateContents(TabContents* contents) { | 85 void HtmlDialogTabContentsDelegate::DeactivateContents(TabContents* contents) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 103 void HtmlDialogTabContentsDelegate::UpdateTargetURL(TabContents* source, | 105 void HtmlDialogTabContentsDelegate::UpdateTargetURL(TabContents* source, |
| 104 const GURL& url) { | 106 const GURL& url) { |
| 105 // Ignored. | 107 // Ignored. |
| 106 } | 108 } |
| 107 | 109 |
| 108 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( | 110 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( |
| 109 const history::HistoryAddPageArgs& add_page_args, | 111 const history::HistoryAddPageArgs& add_page_args, |
| 110 NavigationType::Type navigation_type) { | 112 NavigationType::Type navigation_type) { |
| 111 return false; | 113 return false; |
| 112 } | 114 } |
| OLD | NEW |