| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 IncludePrivacySensitiveFields include_privacy_sensitive_fields) { | 65 IncludePrivacySensitiveFields include_privacy_sensitive_fields) { |
| 66 return CreateTabValue(web_contents, NULL, -1, | 66 return CreateTabValue(web_contents, NULL, -1, |
| 67 include_privacy_sensitive_fields); | 67 include_privacy_sensitive_fields); |
| 68 } | 68 } |
| 69 static base::DictionaryValue* CreateTabValue( | 69 static base::DictionaryValue* CreateTabValue( |
| 70 const content::WebContents* web_contents, | 70 const content::WebContents* web_contents, |
| 71 TabStripModel* tab_strip, | 71 TabStripModel* tab_strip, |
| 72 int tab_index, | 72 int tab_index, |
| 73 IncludePrivacySensitiveFields include_privacy_sensitive_fields); | 73 IncludePrivacySensitiveFields include_privacy_sensitive_fields); |
| 74 | 74 |
| 75 // Remove any privacy-sensitive fields from a Tab object or event info |
| 76 // dictionary, if the extension does not have the tabs permission. Returns a |
| 77 // new dictionary value; the input update_info dictionary is left unmodified. |
| 78 static base::DictionaryValue* ScrubTabValue( |
| 79 const content::WebContents* contents, |
| 80 const extensions::Extension* extension, |
| 81 const base::DictionaryValue* update_info); |
| 82 |
| 75 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. | 83 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. |
| 76 static bool GetTabStripModel(const content::WebContents* web_contents, | 84 static bool GetTabStripModel(const content::WebContents* web_contents, |
| 77 TabStripModel** tab_strip_model, | 85 TabStripModel** tab_strip_model, |
| 78 int* tab_index); | 86 int* tab_index); |
| 79 static bool GetDefaultTab(Browser* browser, | 87 static bool GetDefaultTab(Browser* browser, |
| 80 content::WebContents** contents, | 88 content::WebContents** contents, |
| 81 int* tab_id); | 89 int* tab_id); |
| 82 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 90 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
| 83 // be NULL and will not be set within the function. | 91 // be NULL and will not be set within the function. |
| 84 static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, | 92 static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 110 | 118 |
| 111 // Executes the specified callback for all tabs in all browser windows. | 119 // Executes the specified callback for all tabs in all browser windows. |
| 112 static void ForEachTab( | 120 static void ForEachTab( |
| 113 const base::Callback<void(content::WebContents*)>& callback); | 121 const base::Callback<void(content::WebContents*)>& callback); |
| 114 | 122 |
| 115 static extensions::WindowController* GetWindowControllerOfTab( | 123 static extensions::WindowController* GetWindowControllerOfTab( |
| 116 const content::WebContents* web_contents); | 124 const content::WebContents* web_contents); |
| 117 }; | 125 }; |
| 118 | 126 |
| 119 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 127 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
| OLD | NEW |