1// 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_
7
8class Browser;
9class GURL;
10
11// Methods for opening "singleton tabs". Tabs are guaranteed unique by varying
12// metrics within a particular Browser window.
13
14namespace chrome {
15
16struct NavigateParams;
17
18// Core singleton tab API:
19
20// Show a given a URL. If a tab with the same URL (ignoring the ref) is
21// already visible in this browser, it becomes selected. Otherwise a new tab
22// is created.
23void ShowSingletonTab(Browser* browser, const GURL& url);
24
25// Same as ShowSingletonTab, but does not ignore ref.
26void ShowSingletonTabRespectRef(Browser* browser, const GURL& url);
27
28// As ShowSingletonTab, but if the current tab is the new tab page or
29// about:blank, then overwrite it with the passed contents.
30void ShowSingletonTabOverwritingNTP(Browser* browser,
31                                    const NavigateParams& params);
32
33// Creates a NavigateParams struct for a singleton tab navigation.
34NavigateParams GetSingletonTabNavigateParams(Browser* browser, const GURL& url);
35
36// If the given navigational URL is a Singleton, return the tab index for it.
37// Otherwise, returns -1.
38int GetIndexOfSingletonTab(NavigateParams* params);
39
40}  // namespace chrome
41
42#endif  // CHROME_BROWSER_UI_SINGLETON_TABS_H_
43