| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_COMMON_EXTENSIONS_EXTENSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Icon sizes used by the extension system. | 66 // Icon sizes used by the extension system. |
| 67 static const int kIconSizes[]; | 67 static const int kIconSizes[]; |
| 68 | 68 |
| 69 // Max size (both dimensions) for browser and page actions. | 69 // Max size (both dimensions) for browser and page actions. |
| 70 static const int kPageActionIconMaxSize; | 70 static const int kPageActionIconMaxSize; |
| 71 static const int kBrowserActionIconMaxSize; | 71 static const int kBrowserActionIconMaxSize; |
| 72 | 72 |
| 73 // Each permission is a module that the extension is permitted to use. | 73 // Each permission is a module that the extension is permitted to use. |
| 74 static const char* kTabPermission; |
| 75 static const char* kBookmarkPermission; |
| 76 |
| 74 static const char* kPermissionNames[]; | 77 static const char* kPermissionNames[]; |
| 75 static const size_t kNumPermissions; | 78 static const size_t kNumPermissions; |
| 76 | 79 |
| 77 struct PrivacyBlacklistInfo { | 80 struct PrivacyBlacklistInfo { |
| 78 FilePath path; // Path to the plain-text blacklist. | 81 FilePath path; // Path to the plain-text blacklist. |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 // An NPAPI plugin included in the extension. | 84 // An NPAPI plugin included in the extension. |
| 82 struct PluginInfo { | 85 struct PluginInfo { |
| 83 FilePath path; // Path to the plugin. | 86 FilePath path; // Path to the plugin. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return api_permissions_; | 206 return api_permissions_; |
| 204 } | 207 } |
| 205 const HostPermissions& host_permissions() const { | 208 const HostPermissions& host_permissions() const { |
| 206 return host_permissions_; | 209 return host_permissions_; |
| 207 } | 210 } |
| 208 | 211 |
| 209 // Returns true if the extension has permission to access the host for the | 212 // Returns true if the extension has permission to access the host for the |
| 210 // specified URL. | 213 // specified URL. |
| 211 bool CanAccessHost(const GURL& url) const; | 214 bool CanAccessHost(const GURL& url) const; |
| 212 | 215 |
| 216 // Returns true if the extension has the specified API permission. |
| 217 bool HasApiPermission(const std::string& permission) const { |
| 218 return std::find(api_permissions_.begin(), api_permissions_.end(), |
| 219 permission) != api_permissions_.end(); |
| 220 } |
| 221 |
| 213 // Returns the set of hosts that the extension effectively has access to. This | 222 // Returns the set of hosts that the extension effectively has access to. This |
| 214 // is used in the permissions UI and is a combination of the hosts accessible | 223 // is used in the permissions UI and is a combination of the hosts accessible |
| 215 // through content scripts and the hosts accessible through XHR. | 224 // through content scripts and the hosts accessible through XHR. |
| 216 const std::set<std::string> GetEffectiveHostPermissions() const; | 225 const std::set<std::string> GetEffectiveHostPermissions() const; |
| 217 | 226 |
| 218 // Whether the extension has access to all hosts. This is true if there is | 227 // Whether the extension has access to all hosts. This is true if there is |
| 219 // a content script that matches all hosts, or if there is a host permission | 228 // a content script that matches all hosts, or if there is a host permission |
| 220 // for all hosts. | 229 // for all hosts. |
| 221 bool HasAccessToAllHosts() const; | 230 bool HasAccessToAllHosts() const; |
| 222 | 231 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 392 |
| 384 // True if the background page is ready. | 393 // True if the background page is ready. |
| 385 bool background_page_ready_; | 394 bool background_page_ready_; |
| 386 | 395 |
| 387 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); | 396 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); |
| 388 | 397 |
| 389 DISALLOW_COPY_AND_ASSIGN(Extension); | 398 DISALLOW_COPY_AND_ASSIGN(Extension); |
| 390 }; | 399 }; |
| 391 | 400 |
| 392 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 401 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |