| 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 19 matching lines...) Expand all Loading... |
| 30 class WindowController; | 30 class WindowController; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace gfx { | 33 namespace gfx { |
| 34 class Rect; | 34 class Rect; |
| 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 enum PrivacyFlags { |
| 41 INCLUDE_PRIVACY_SENSITIVE_FIELDS, |
| 42 OMIT_PRIVACY_SENSITIVE_FIELDS |
| 43 }; |
| 44 |
| 40 static int GetWindowId(const Browser* browser); | 45 static int GetWindowId(const Browser* browser); |
| 41 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); | 46 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); |
| 42 static int GetTabId(const content::WebContents* web_contents); | 47 static int GetTabId(const content::WebContents* web_contents); |
| 43 static std::string GetTabStatusText(bool is_loading); | 48 static std::string GetTabStatusText(bool is_loading); |
| 44 static int GetWindowIdOfTab(const content::WebContents* web_contents); | 49 static int GetWindowIdOfTab(const content::WebContents* web_contents); |
| 45 static base::ListValue* CreateTabList(const Browser* browser); | 50 static base::ListValue* CreateTabList(const Browser* browser); |
| 46 static base::DictionaryValue* CreateTabValue( | 51 static base::DictionaryValue* CreateTabValue( |
| 47 const content::WebContents* web_contents); | 52 const content::WebContents* web_contents); |
| 48 static base::DictionaryValue* CreateTabValue( | 53 static base::DictionaryValue* CreateTabValue( |
| 49 const content::WebContents* web_contents, | 54 const content::WebContents* web_contents, |
| 50 TabStripModel* tab_strip, | 55 TabStripModel* tab_strip, |
| 51 int tab_index); | 56 int tab_index); |
| 57 static base::DictionaryValue* CreateTabValue( |
| 58 const content::WebContents* web_contents, |
| 59 TabStripModel* tab_strip, |
| 60 int tab_index, PrivacyFlags flag); |
| 52 // Create a tab value, overriding its kSelectedKey to the provided boolean. | 61 // Create a tab value, overriding its kSelectedKey to the provided boolean. |
| 53 static base::DictionaryValue* CreateTabValueActive( | 62 static base::DictionaryValue* CreateTabValueActive( |
| 54 const content::WebContents* web_contents, | 63 const content::WebContents* web_contents, |
| 55 bool active); | 64 bool active); |
| 56 | 65 |
| 57 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. | 66 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. |
| 58 static bool GetTabStripModel(const content::WebContents* web_contents, | 67 static bool GetTabStripModel(const content::WebContents* web_contents, |
| 59 TabStripModel** tab_strip_model, | 68 TabStripModel** tab_strip_model, |
| 60 int* tab_index); | 69 int* tab_index); |
| 61 static bool GetDefaultTab(Browser* browser, | 70 static bool GetDefaultTab(Browser* browser, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 92 | 101 |
| 93 // Executes the specified callback for all tabs in all browser windows. | 102 // Executes the specified callback for all tabs in all browser windows. |
| 94 static void ForEachTab( | 103 static void ForEachTab( |
| 95 const base::Callback<void(content::WebContents*)>& callback); | 104 const base::Callback<void(content::WebContents*)>& callback); |
| 96 | 105 |
| 97 static extensions::WindowController* GetWindowControllerOfTab( | 106 static extensions::WindowController* GetWindowControllerOfTab( |
| 98 const content::WebContents* web_contents); | 107 const content::WebContents* web_contents); |
| 99 }; | 108 }; |
| 100 | 109 |
| 101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 110 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
| OLD | NEW |