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