Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Unified Diff: chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc

Issue 4055004: Change window opening behavior for HtmlDialogTabContentsDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased from trunk and fixed comments in HtmlDialogTabContentsDelegate Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
diff --git a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
index 303d0719275078afdef1bcc98ed313d6376b2573..cc8ae0716c37636ff355b948cad77ec9172f9d2c 100644
--- a/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
+++ b/chrome/browser/dom_ui/html_dialog_tab_contents_delegate.cc
@@ -27,22 +27,17 @@ void HtmlDialogTabContentsDelegate::Detach() {
profile_ = NULL;
}
-Browser* HtmlDialogTabContentsDelegate::CreateBrowser() {
- DCHECK(profile_);
- return Browser::Create(profile_);
-}
-
void HtmlDialogTabContentsDelegate::OpenURLFromTab(
TabContents* source, const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition, PageTransition::Type transition) {
if (profile_) {
- // Force all links to open in a new window, ignoring the incoming
- // disposition. This is a tabless, modal dialog so we can't just
- // open it in the current frame. Code adapted from
- // Browser::OpenURLFromTab() with disposition == NEW_WINDOW.
- browser::NavigateParams params(CreateBrowser(), url, transition);
+ // Specify a NULL browser for navigation. This will cause Navigate()
+ // to find a browser matching params.profile or create a new one.
+ Browser* browser = NULL;
+ browser::NavigateParams params(browser, url, transition);
+ params.profile = profile_;
params.referrer = referrer;
- params.disposition = NEW_FOREGROUND_TAB;
+ params.disposition = disposition;
params.show_window = true;
browser::Navigate(&params);
}
@@ -59,11 +54,13 @@ void HtmlDialogTabContentsDelegate::AddNewContents(
WindowOpenDisposition disposition, const gfx::Rect& initial_pos,
bool user_gesture) {
if (profile_) {
- // Force this to open in a new window so that it appears at the top
- // of the z-index.
- browser::NavigateParams params(CreateBrowser(), new_contents);
+ // Specify a NULL browser for navigation. This will cause Navigate()
+ // to find a browser matching params.profile or create a new one.
+ Browser* browser = NULL;
+ browser::NavigateParams params(browser, new_contents);
+ params.profile = profile_;
params.source_contents = source;
- params.disposition = NEW_FOREGROUND_TAB;
+ params.disposition = disposition;
params.window_bounds = initial_pos;
params.show_window = true;
browser::Navigate(&params);
@@ -111,4 +108,3 @@ bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory(
NavigationType::Type navigation_type) {
return false;
}
-

Powered by Google App Engine
This is Rietveld 408576698