| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_SINGLETON_TABS_H_ | 5 #ifndef CHROME_BROWSER_UI_SINGLETON_TABS_H_ |
| 6 #define CHROME_BROWSER_UI_SINGLETON_TABS_H_ | 6 #define CHROME_BROWSER_UI_SINGLETON_TABS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 class Browser; | 9 class Browser; |
| 10 class GURL; | 10 class GURL; |
| 11 | 11 |
| 12 namespace browser { | |
| 13 struct NavigateParams; | |
| 14 } | |
| 15 | |
| 16 // Methods for opening "singleton tabs". Tabs are guaranteed unique by varying | 12 // Methods for opening "singleton tabs". Tabs are guaranteed unique by varying |
| 17 // metrics within a particular Browser window. | 13 // metrics within a particular Browser window. |
| 18 | 14 |
| 19 namespace chrome { | 15 namespace chrome { |
| 20 | 16 |
| 17 struct NavigateParams; |
| 18 |
| 21 // Core singleton tab API: | 19 // Core singleton tab API: |
| 22 | 20 |
| 23 // Show a given a URL. If a tab with the same URL (ignoring the ref) is | 21 // Show a given a URL. If a tab with the same URL (ignoring the ref) is |
| 24 // already visible in this browser, it becomes selected. Otherwise a new tab | 22 // already visible in this browser, it becomes selected. Otherwise a new tab |
| 25 // is created. | 23 // is created. |
| 26 void ShowSingletonTab(Browser* browser, const GURL& url); | 24 void ShowSingletonTab(Browser* browser, const GURL& url); |
| 27 | 25 |
| 28 // Same as ShowSingletonTab, but does not ignore ref. | 26 // Same as ShowSingletonTab, but does not ignore ref. |
| 29 void ShowSingletonTabRespectRef(Browser* browser, const GURL& url); | 27 void ShowSingletonTabRespectRef(Browser* browser, const GURL& url); |
| 30 | 28 |
| 31 // As ShowSingletonTab, but if the current tab is the new tab page or | 29 // As ShowSingletonTab, but if the current tab is the new tab page or |
| 32 // about:blank, then overwrite it with the passed contents. | 30 // about:blank, then overwrite it with the passed contents. |
| 33 void ShowSingletonTabOverwritingNTP(Browser* browser, | 31 void ShowSingletonTabOverwritingNTP(Browser* browser, |
| 34 const browser::NavigateParams& params); | 32 const NavigateParams& params); |
| 35 | 33 |
| 36 // Creates a NavigateParams struct for a singleton tab navigation. | 34 // Creates a NavigateParams struct for a singleton tab navigation. |
| 37 browser::NavigateParams GetSingletonTabNavigateParams(Browser* browser, | 35 NavigateParams GetSingletonTabNavigateParams(Browser* browser, const GURL& url); |
| 38 const GURL& url); | |
| 39 | 36 |
| 40 // If the given navigational URL is a Singleton, return the tab index for it. | 37 // If the given navigational URL is a Singleton, return the tab index for it. |
| 41 // Otherwise, returns -1. | 38 // Otherwise, returns -1. |
| 42 int GetIndexOfSingletonTab(browser::NavigateParams* params); | 39 int GetIndexOfSingletonTab(NavigateParams* params); |
| 43 | 40 |
| 44 } // namespace chrome | 41 } // namespace chrome |
| 45 | 42 |
| 46 #endif // CHROME_BROWSER_UI_SINGLETON_TABS_H_ | 43 #endif // CHROME_BROWSER_UI_SINGLETON_TABS_H_ |
| OLD | NEW |