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_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 // Provides various utility functions that help manipulate tabs. | 37 // Provides various utility functions that help manipulate tabs. |
38 class ExtensionTabUtil { | 38 class ExtensionTabUtil { |
39 public: | 39 public: |
40 static int GetWindowId(const Browser* browser); | 40 static int GetWindowId(const Browser* browser); |
41 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); | 41 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); |
42 static int GetTabId(const content::WebContents* web_contents); | 42 static int GetTabId(const content::WebContents* web_contents); |
43 static std::string GetTabStatusText(bool is_loading); | 43 static std::string GetTabStatusText(bool is_loading); |
44 static int GetWindowIdOfTab(const content::WebContents* web_contents); | 44 static int GetWindowIdOfTab(const content::WebContents* web_contents); |
45 static base::ListValue* CreateTabList(const Browser* browser); | 45 static base::ListValue* CreateTabList( |
| 46 const Browser* browser, |
| 47 const extensions::Extension* extension); |
46 static base::DictionaryValue* CreateTabValue( | 48 static base::DictionaryValue* CreateTabValue( |
47 const content::WebContents* web_contents); | 49 const content::WebContents* web_contents, |
| 50 const extensions::Extension* extension); |
48 static base::DictionaryValue* CreateTabValue( | 51 static base::DictionaryValue* CreateTabValue( |
49 const content::WebContents* web_contents, | 52 const content::WebContents* web_contents, |
50 TabStripModel* tab_strip, | 53 TabStripModel* tab_strip, |
51 int tab_index); | 54 int tab_index, |
| 55 const extensions::Extension* extension); |
52 // Create a tab value, overriding its kSelectedKey to the provided boolean. | 56 // Create a tab value, overriding its kSelectedKey to the provided boolean. |
53 static base::DictionaryValue* CreateTabValueActive( | 57 static base::DictionaryValue* CreateTabValueActive( |
54 const content::WebContents* web_contents, | 58 const content::WebContents* web_contents, |
55 bool active); | 59 bool active, |
| 60 const extensions::Extension* extension); |
56 | 61 |
57 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. | 62 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. |
58 static bool GetTabStripModel(const content::WebContents* web_contents, | 63 static bool GetTabStripModel(const content::WebContents* web_contents, |
59 TabStripModel** tab_strip_model, | 64 TabStripModel** tab_strip_model, |
60 int* tab_index); | 65 int* tab_index); |
61 static bool GetDefaultTab(Browser* browser, | 66 static bool GetDefaultTab(Browser* browser, |
62 TabContents** contents, | 67 TabContents** contents, |
63 int* tab_id); | 68 int* tab_id); |
64 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 69 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
65 // be NULL and will not be set within the function. | 70 // be NULL and will not be set within the function. |
(...skipping 26 matching lines...) Expand all Loading... |
92 | 97 |
93 // Executes the specified callback for all tabs in all browser windows. | 98 // Executes the specified callback for all tabs in all browser windows. |
94 static void ForEachTab( | 99 static void ForEachTab( |
95 const base::Callback<void(content::WebContents*)>& callback); | 100 const base::Callback<void(content::WebContents*)>& callback); |
96 | 101 |
97 static extensions::WindowController* GetWindowControllerOfTab( | 102 static extensions::WindowController* GetWindowControllerOfTab( |
98 const content::WebContents* web_contents); | 103 const content::WebContents* web_contents); |
99 }; | 104 }; |
100 | 105 |
101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 106 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
OLD | NEW |