| 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 10 matching lines...) Expand all Loading... |
| 21 : profile_(profile) {} | 21 : profile_(profile) {} |
| 22 | 22 |
| 23 HtmlDialogTabContentsDelegate::~HtmlDialogTabContentsDelegate() {} | 23 HtmlDialogTabContentsDelegate::~HtmlDialogTabContentsDelegate() {} |
| 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. | |
| 32 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( | |
| 33 TabContents* source, const GURL& url, const GURL& referrer, | |
| 34 WindowOpenDisposition disposition, content::PageTransition transition) { | |
| 35 return OpenURLFromTab(source, | |
| 36 OpenURLParams(url, referrer, disposition, transition, | |
| 37 false)); | |
| 38 } | |
| 39 | |
| 40 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( | 31 TabContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( |
| 41 TabContents* source, const OpenURLParams& params) { | 32 TabContents* source, const OpenURLParams& params) { |
| 42 if (profile_) { | 33 if (profile_) { |
| 43 // Specify a NULL browser for navigation. This will cause Navigate() | 34 // Specify a NULL browser for navigation. This will cause Navigate() |
| 44 // to find a browser matching params.profile or create a new one. | 35 // to find a browser matching params.profile or create a new one. |
| 45 Browser* browser = NULL; | 36 Browser* browser = NULL; |
| 46 browser::NavigateParams nav_params(browser, params.url, params.transition); | 37 browser::NavigateParams nav_params(browser, params.url, params.transition); |
| 47 nav_params.profile = profile_; | 38 nav_params.profile = profile_; |
| 48 nav_params.referrer = params.referrer; | 39 nav_params.referrer = params.referrer; |
| 49 if (source && source->is_crashed() && | 40 if (source && source->is_crashed() && |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // This needs to return true so that we are allowed to be resized by our | 79 // This needs to return true so that we are allowed to be resized by our |
| 89 // contents. | 80 // contents. |
| 90 return true; | 81 return true; |
| 91 } | 82 } |
| 92 | 83 |
| 93 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( | 84 bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( |
| 94 const history::HistoryAddPageArgs& add_page_args, | 85 const history::HistoryAddPageArgs& add_page_args, |
| 95 content::NavigationType navigation_type) { | 86 content::NavigationType navigation_type) { |
| 96 return false; | 87 return false; |
| 97 } | 88 } |
| OLD | NEW |