| 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_ACTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Gets the visibility of |tab_id|. Returns the first of: a specific | 161 // Gets the visibility of |tab_id|. Returns the first of: a specific |
| 162 // visibility set on the tab; a declarative visibility set on the tab; the | 162 // visibility set on the tab; a declarative visibility set on the tab; the |
| 163 // default visibility set for all tabs; or |false|. Don't return this | 163 // default visibility set for all tabs; or |false|. Don't return this |
| 164 // result to an extension's background page because the declarative state can | 164 // result to an extension's background page because the declarative state can |
| 165 // leak information about hosts the extension doesn't have permission to | 165 // leak information about hosts the extension doesn't have permission to |
| 166 // access. | 166 // access. |
| 167 bool GetIsVisible(int tab_id) const { | 167 bool GetIsVisible(int tab_id) const { |
| 168 if (const bool* tab_is_visible = FindOrNull(&is_visible_, tab_id)) | 168 if (const bool* tab_is_visible = FindOrNull(&is_visible_, tab_id)) |
| 169 return *tab_is_visible; | 169 return *tab_is_visible; |
| 170 | 170 |
| 171 if (ContainsKey(declarative_show_count_, tab_id)) | 171 if (base::ContainsKey(declarative_show_count_, tab_id)) |
| 172 return true; | 172 return true; |
| 173 | 173 |
| 174 if (const bool* default_is_visible = | 174 if (const bool* default_is_visible = |
| 175 FindOrNull(&is_visible_, kDefaultTabId)) | 175 FindOrNull(&is_visible_, kDefaultTabId)) |
| 176 return *default_is_visible; | 176 return *default_is_visible; |
| 177 | 177 |
| 178 return false; | 178 return false; |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Remove all tab-specific state. | 181 // Remove all tab-specific state. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 }; | 302 }; |
| 303 | 303 |
| 304 template<> | 304 template<> |
| 305 struct ExtensionAction::ValueTraits<int> { | 305 struct ExtensionAction::ValueTraits<int> { |
| 306 static int CreateEmpty() { | 306 static int CreateEmpty() { |
| 307 return -1; | 307 return -1; |
| 308 } | 308 } |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ | 311 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_H_ |
| OLD | NEW |