blob: feb21e64a069a4efe6f9918d098116f28f142fff [file] [log] [blame]
[email protected]5d9cace72012-06-21 16:07:121// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_SINGLETON_TABS_H_
6#define CHROME_BROWSER_UI_SINGLETON_TABS_H_
[email protected]5d9cace72012-06-21 16:07:127
thestige80821242015-09-30 23:46:088#include "chrome/browser/ui/browser_navigator_params.h"
9
[email protected]5d9cace72012-06-21 16:07:1210class Browser;
11class GURL;
12
[email protected]5d9cace72012-06-21 16:07:1213// Methods for opening "singleton tabs". Tabs are guaranteed unique by varying
14// metrics within a particular Browser window.
15
[email protected]5d9cace72012-06-21 16:07:1216// Core singleton tab API:
17
18// Show a given a URL. If a tab with the same URL (ignoring the ref) is
19// already visible in this browser, it becomes selected. Otherwise a new tab
20// is created.
21void ShowSingletonTab(Browser* browser, const GURL& url);
22
23// Same as ShowSingletonTab, but does not ignore ref.
24void ShowSingletonTabRespectRef(Browser* browser, const GURL& url);
25
26// As ShowSingletonTab, but if the current tab is the new tab page or
27// about:blank, then overwrite it with the passed contents.
erikchen38fa4022018-04-26 20:37:5228void ShowSingletonTabOverwritingNTP(Browser* browser, NavigateParams params);
[email protected]5d9cace72012-06-21 16:07:1229
30// Creates a NavigateParams struct for a singleton tab navigation.
[email protected]78e2edc2012-07-01 23:32:2831NavigateParams GetSingletonTabNavigateParams(Browser* browser, const GURL& url);
[email protected]5d9cace72012-06-21 16:07:1232
Kevin Baileyc8f9ef322018-01-05 17:19:5533// If the given navigational URL is already open in |browser|, return
34// the tab and tab index for it. Otherwise, returns -1.
35int GetIndexOfExistingTab(Browser* browser, const NavigateParams& params);
[email protected]5d9cace72012-06-21 16:07:1236
Kevin Bailey29343422019-10-04 00:22:5137// This simply calls GetIndexOfExistingTab() for each browser that
38// matches the passed |profile|, and returns the first found tab.
39std::pair<Browser*, int> GetIndexAndBrowserOfExistingTab(
40 Profile* profile,
41 const NavigateParams& params);
42
[email protected]5d9cace72012-06-21 16:07:1243#endif // CHROME_BROWSER_UI_SINGLETON_TABS_H_