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 8 class Browser; 9 class GURL; 10 11 // Methods for opening "singleton tabs". Tabs are guaranteed unique by varying 12 // metrics within a particular Browser window. 13 14 namespace chrome { 15 16 struct 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. 23 void ShowSingletonTab(Browser* browser, const GURL& url); 24 25 // Same as ShowSingletonTab, but does not ignore ref. 26 void 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. 30 void ShowSingletonTabOverwritingNTP(Browser* browser, 31 const NavigateParams& params); 32 33 // Creates a NavigateParams struct for a singleton tab navigation. 34 NavigateParams 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. 38 int GetIndexOfSingletonTab(NavigateParams* params); 39 40 } // namespace chrome 41 42 #endif // CHROME_BROWSER_UI_SINGLETON_TABS_H_ 43