diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 19:55:14 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 19:55:14 +0000 |
commit | 82404cd25e38e79bca2fc5544dfe656d8c6bdd4e (patch) | |
tree | 8f55bf4b61958f1bf5a40fbae92e06f19079f3e9 /chrome/browser | |
parent | c045b1a761ab1a77fb374dbe9ef5c1d0aaa8789d (diff) | |
download | chromium_src-82404cd25e38e79bca2fc5544dfe656d8c6bdd4e.zip chromium_src-82404cd25e38e79bca2fc5544dfe656d8c6bdd4e.tar.gz chromium_src-82404cd25e38e79bca2fc5544dfe656d8c6bdd4e.tar.bz2 |
Change navigator to open non-incognito pages in current page
for settings/bookmark manager, and use bookmark_utils in gtk.
Pass browser as PageNavigator in GTK instead of TabContents.
R=jhawkins@chromium.org
BUG=83819
TEST=BrowserNavigatorTest.Disposition_Settings_UseNonIncognitoWindowForBookmark
Review URL: http://codereview.chromium.org/7331044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/browser_navigator.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/browser_navigator_browsertest.cc | 19 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_window_gtk.cc | 2 |
4 files changed, 25 insertions, 6 deletions
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 81ae69b..6352440 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -96,7 +96,8 @@ void AdjustNavigateParamsForURL(browser::NavigateParams* params) { Profile* profile = params->browser ? params->browser->profile() : params->profile; - if (profile->IsOffTheRecord() && !Profile::IsGuestSession()) { + if ((profile->IsOffTheRecord() && !Profile::IsGuestSession()) || + params->disposition == OFF_THE_RECORD) { profile = profile->GetOriginalProfile(); params->disposition = SINGLETON_TAB; diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 4f9e897..71a9249 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -836,6 +836,25 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, browser()->GetSelectedTabContents()->GetURL()); } +// This test verifies that the settings page isn't opened in the incognito +// window from a non-incognito window (bookmark open-in-incognito trigger). +IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, + Disposition_Settings_UseNonIncognitoWindowForBookmark) { + browser::NavigateParams params(browser(), GURL("chrome://settings"), + PageTransition::AUTO_BOOKMARK); + params.disposition = OFF_THE_RECORD; + { + ui_test_utils::WindowedNotificationObserver observer( + content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); + browser::Navigate(¶ms); + observer.Wait(); + } + + EXPECT_EQ(1u, BrowserList::size()); + EXPECT_EQ(GURL("chrome://settings"), + browser()->GetSelectedTabContents()->GetURL().GetOrigin()); +} + // This test verifies that the bookmarks page isn't opened in the incognito // window. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index b4ba446..08a7749 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -1131,10 +1131,9 @@ void BookmarkBarGtk::OnClicked(GtkWidget* sender) { DCHECK(page_navigator_); RecordAppLaunch(profile_, node->GetURL()); - page_navigator_->OpenURL( - node->GetURL(), GURL(), - gtk_util::DispositionForCurrentButtonPressEvent(), - PageTransition::AUTO_BOOKMARK); + bookmark_utils::OpenAll(window_->GetNativeHandle(), + profile_, page_navigator_, node, + gtk_util::DispositionForCurrentButtonPressEvent()); UserMetrics::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 2d6c9f4..47e8b2d 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1294,7 +1294,7 @@ void BrowserWindowGtk::MaybeShowBookmarkBar(bool animate) { if (tab) { bookmark_bar_->SetProfile(tab->profile()); - bookmark_bar_->SetPageNavigator(tab->tab_contents()); + bookmark_bar_->SetPageNavigator(browser_.get()); } BookmarkBar::State state = browser_->bookmark_bar_state(); |