Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / singleton_tabs.h
blob04ed83d4a33180f39988b96b7cfce0eefeb6878b
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.
5 #ifndef CHROME_BROWSER_UI_SINGLETON_TABS_H_
6 #define CHROME_BROWSER_UI_SINGLETON_TABS_H_
8 class Browser;
9 class GURL;
11 // Methods for opening "singleton tabs". Tabs are guaranteed unique by varying
12 // metrics within a particular Browser window.
14 namespace chrome {
16 struct NavigateParams;
18 // Core singleton tab API:
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.
23 void ShowSingletonTab(Browser* browser, const GURL& url);
25 // Same as ShowSingletonTab, but does not ignore ref.
26 void ShowSingletonTabRespectRef(Browser* browser, const GURL& url);
28 // As ShowSingletonTab, but if the current tab is the new tab page or
29 // about:blank, then overwrite it with the passed contents.
30 void ShowSingletonTabOverwritingNTP(Browser* browser,
31 const NavigateParams& params);
33 // Creates a NavigateParams struct for a singleton tab navigation.
34 NavigateParams GetSingletonTabNavigateParams(Browser* browser, const GURL& url);
36 // If the given navigational URL is a Singleton, return the tab index for it.
37 // Otherwise, returns -1.
38 int GetIndexOfSingletonTab(NavigateParams* params);
40 } // namespace chrome
42 #endif // CHROME_BROWSER_UI_SINGLETON_TABS_H_