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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 Profile* HtmlDialogTabContentsDelegate::profile() const { return profile_; } | 25 Profile* HtmlDialogTabContentsDelegate::profile() const { return profile_; } |
26 | 26 |
27 void HtmlDialogTabContentsDelegate::Detach() { | 27 void HtmlDialogTabContentsDelegate::Detach() { |
28 profile_ = NULL; | 28 profile_ = NULL; |
29 } | 29 } |
30 | 30 |
31 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 31 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
32 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( | 32 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( |
33 TabContents* source, const GURL& url, const GURL& referrer, | 33 TabContents* source, const GURL& url, const GURL& referrer, |
34 WindowOpenDisposition disposition, PageTransition::Type transition) { | 34 WindowOpenDisposition disposition, content::PageTransition transition) { |
35 return OpenURLFromTab(source, | 35 return OpenURLFromTab(source, |
36 OpenURLParams(url, referrer, disposition, transition)); | 36 OpenURLParams(url, referrer, disposition, transition)); |
37 } | 37 } |
38 | 38 |
39 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( | 39 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( |
40 TabContents* source, const OpenURLParams& params) { | 40 TabContents* source, const OpenURLParams& params) { |
41 if (profile_) { | 41 if (profile_) { |
42 // Specify a NULL browser for navigation. This will cause Navigate() | 42 // Specify a NULL browser for navigation. This will cause Navigate() |
43 // to find a browser matching params.profile or create a new one. | 43 // to find a browser matching params.profile or create a new one. |
44 Browser* browser = NULL; | 44 Browser* browser = NULL; |
45 browser::NavigateParams nav_params(browser, params.url, params.transition); | 45 browser::NavigateParams nav_params(browser, params.url, params.transition); |
46 nav_params.profile = profile_; | 46 nav_params.profile = profile_; |
47 nav_params.referrer = params.referrer; | 47 nav_params.referrer = params.referrer; |
48 if (source && source->is_crashed() && | 48 if (source && source->is_crashed() && |
49 params.disposition == CURRENT_TAB && | 49 params.disposition == CURRENT_TAB && |
50 params.transition == PageTransition::LINK) | 50 params.transition == content::PAGE_TRANSITION_LINK) |
51 nav_params.disposition = NEW_FOREGROUND_TAB; | 51 nav_params.disposition = NEW_FOREGROUND_TAB; |
52 else | 52 else |
53 nav_params.disposition = params.disposition; | 53 nav_params.disposition = params.disposition; |
54 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | 54 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; |
55 nav_params.user_gesture = true; | 55 nav_params.user_gesture = true; |
56 browser::Navigate(&nav_params); | 56 browser::Navigate(&nav_params); |
57 return nav_params.target_contents ? | 57 return nav_params.target_contents ? |
58 nav_params.target_contents->tab_contents() : NULL; | 58 nav_params.target_contents->tab_contents() : NULL; |
59 } | 59 } |
60 return NULL; | 60 return NULL; |
(...skipping 25 matching lines...) Expand all Loading... |
86 // This needs to return true so that we are allowed to be resized by our | 86 // This needs to return true so that we are allowed to be resized by our |
87 // contents. | 87 // contents. |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( | 91 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( |
92 const history::HistoryAddPageArgs& add_page_args, | 92 const history::HistoryAddPageArgs& add_page_args, |
93 NavigationType::Type navigation_type) { | 93 NavigationType::Type navigation_type) { |
94 return false; | 94 return false; |
95 } | 95 } |
OLD | NEW |