| 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 27 matching lines...) Expand all Loading... |
| 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( | 45 static base::ListValue* CreateTabList( |
| 46 const Browser* browser, | 46 const Browser* browser, |
| 47 const extensions::Extension* extension); | 47 const extensions::Extension* extension); |
| 48 |
| 48 static base::DictionaryValue* CreateTabValue( | 49 static base::DictionaryValue* CreateTabValue( |
| 49 const content::WebContents* web_contents, | 50 const content::WebContents* web_contents, |
| 50 const extensions::Extension* extension); | 51 const extensions::Extension* extension) { |
| 52 return CreateTabValue(web_contents, NULL, -1, extension); |
| 53 } |
| 51 static base::DictionaryValue* CreateTabValue( | 54 static base::DictionaryValue* CreateTabValue( |
| 52 const content::WebContents* web_contents, | 55 const content::WebContents* web_contents, |
| 53 TabStripModel* tab_strip, | 56 TabStripModel* tab_strip, |
| 54 int tab_index, | 57 int tab_index, |
| 55 const extensions::Extension* extension); | 58 const extensions::Extension* extension); |
| 56 // Create a tab value, overriding its kSelectedKey to the provided boolean. | 59 |
| 57 static base::DictionaryValue* CreateTabValueActive( | 60 enum IncludePrivacySensitiveFields { |
| 61 INCLUDE_PRIVACY_SENSITIVE_FIELDS, |
| 62 OMIT_PRIVACY_SENSITIVE_FIELDS |
| 63 }; |
| 64 static base::DictionaryValue* CreateTabValue( |
| 58 const content::WebContents* web_contents, | 65 const content::WebContents* web_contents, |
| 59 bool active, | 66 IncludePrivacySensitiveFields include_privacy_sensitive_fields) { |
| 60 const extensions::Extension* extension); | 67 return CreateTabValue(web_contents, NULL, -1, |
| 68 include_privacy_sensitive_fields); |
| 69 } |
| 70 static base::DictionaryValue* CreateTabValue( |
| 71 const content::WebContents* web_contents, |
| 72 TabStripModel* tab_strip, |
| 73 int tab_index, |
| 74 IncludePrivacySensitiveFields include_privacy_sensitive_fields); |
| 61 | 75 |
| 62 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. | 76 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. |
| 63 static bool GetTabStripModel(const content::WebContents* web_contents, | 77 static bool GetTabStripModel(const content::WebContents* web_contents, |
| 64 TabStripModel** tab_strip_model, | 78 TabStripModel** tab_strip_model, |
| 65 int* tab_index); | 79 int* tab_index); |
| 66 static bool GetDefaultTab(Browser* browser, | 80 static bool GetDefaultTab(Browser* browser, |
| 67 TabContents** contents, | 81 TabContents** contents, |
| 68 int* tab_id); | 82 int* tab_id); |
| 69 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 83 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
| 70 // be NULL and will not be set within the function. | 84 // be NULL and will not be set within the function. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 97 | 111 |
| 98 // Executes the specified callback for all tabs in all browser windows. | 112 // Executes the specified callback for all tabs in all browser windows. |
| 99 static void ForEachTab( | 113 static void ForEachTab( |
| 100 const base::Callback<void(content::WebContents*)>& callback); | 114 const base::Callback<void(content::WebContents*)>& callback); |
| 101 | 115 |
| 102 static extensions::WindowController* GetWindowControllerOfTab( | 116 static extensions::WindowController* GetWindowControllerOfTab( |
| 103 const content::WebContents* web_contents); | 117 const content::WebContents* web_contents); |
| 104 }; | 118 }; |
| 105 | 119 |
| 106 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 120 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
| OLD | NEW |