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" |
11 #include "ui/base/window_open_disposition.h" | 11 #include "ui/base/window_open_disposition.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
| 14 class ChromeExtensionFunctionDetails; |
14 class ChromeUIThreadExtensionFunction; | 15 class ChromeUIThreadExtensionFunction; |
| 16 class ExtensionFunction; |
15 class GURL; | 17 class GURL; |
16 class Profile; | 18 class Profile; |
17 class TabStripModel; | 19 class TabStripModel; |
18 | 20 |
19 namespace base { | 21 namespace base { |
20 class DictionaryValue; | 22 class DictionaryValue; |
21 class ListValue; | 23 class ListValue; |
22 } | 24 } |
23 | 25 |
24 namespace content { | 26 namespace content { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 const OpenTabParams& params, | 67 const OpenTabParams& params, |
66 std::string* error); | 68 std::string* error); |
67 | 69 |
68 static int GetWindowId(const Browser* browser); | 70 static int GetWindowId(const Browser* browser); |
69 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); | 71 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); |
70 static int GetTabId(const content::WebContents* web_contents); | 72 static int GetTabId(const content::WebContents* web_contents); |
71 static std::string GetTabStatusText(bool is_loading); | 73 static std::string GetTabStatusText(bool is_loading); |
72 static int GetWindowIdOfTab(const content::WebContents* web_contents); | 74 static int GetWindowIdOfTab(const content::WebContents* web_contents); |
73 static base::ListValue* CreateTabList(const Browser* browser, | 75 static base::ListValue* CreateTabList(const Browser* browser, |
74 const Extension* extension); | 76 const Extension* extension); |
| 77 |
| 78 // DEPRECATED: Please consider using ChromeExtensionFunctionDetails instead |
| 79 // of the deprecated ChromeUIThreadExtensionFunction and use the overload |
| 80 // below |
75 static Browser* GetBrowserFromWindowID( | 81 static Browser* GetBrowserFromWindowID( |
76 ChromeUIThreadExtensionFunction* function, | 82 ChromeUIThreadExtensionFunction* function, |
77 int window_id, | 83 int window_id, |
78 std::string* error_message); | 84 std::string* error_message); |
79 | 85 |
| 86 static Browser* GetBrowserFromWindowID( |
| 87 const ChromeExtensionFunctionDetails& details, |
| 88 int window_id, |
| 89 std::string* error_message); |
| 90 |
80 // Creates a Tab object (see chrome/common/extensions/api/tabs.json) with | 91 // Creates a Tab object (see chrome/common/extensions/api/tabs.json) with |
81 // information about the state of a browser tab. Depending on the | 92 // information about the state of a browser tab. Depending on the |
82 // permissions of the extension, the object may or may not include sensitive | 93 // permissions of the extension, the object may or may not include sensitive |
83 // data such as the tab's URL. | 94 // data such as the tab's URL. |
84 static base::DictionaryValue* CreateTabValue( | 95 static base::DictionaryValue* CreateTabValue( |
85 content::WebContents* web_contents, | 96 content::WebContents* web_contents, |
86 const Extension* extension) { | 97 const Extension* extension) { |
87 return CreateTabValue(web_contents, NULL, -1, extension); | 98 return CreateTabValue(web_contents, NULL, -1, extension); |
88 } | 99 } |
89 static base::DictionaryValue* CreateTabValue( | 100 static base::DictionaryValue* CreateTabValue( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 static WindowController* GetWindowControllerOfTab( | 171 static WindowController* GetWindowControllerOfTab( |
161 const content::WebContents* web_contents); | 172 const content::WebContents* web_contents); |
162 | 173 |
163 // Open the extension's options page. | 174 // Open the extension's options page. |
164 static void OpenOptionsPage(const Extension* extension, Browser* browser); | 175 static void OpenOptionsPage(const Extension* extension, Browser* browser); |
165 }; | 176 }; |
166 | 177 |
167 } // namespace extensions | 178 } // namespace extensions |
168 | 179 |
169 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_ | 180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_ |
OLD | NEW |