OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 EXTENSIONS_COMMON_EXTENSION_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_H_ |
6 #define EXTENSIONS_COMMON_EXTENSION_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
23 #include "extensions/common/extension_resource.h" | 23 #include "extensions/common/extension_resource.h" |
24 #include "extensions/common/install_warning.h" | 24 #include "extensions/common/install_warning.h" |
25 #include "extensions/common/manifest.h" | 25 #include "extensions/common/manifest.h" |
26 #include "extensions/common/permissions/api_permission.h" | |
27 #include "extensions/common/url_pattern.h" | |
28 #include "extensions/common/url_pattern_set.h" | 26 #include "extensions/common/url_pattern_set.h" |
29 #include "ui/base/accelerators/accelerator.h" | 27 #include "ui/base/accelerators/accelerator.h" |
30 #include "ui/gfx/size.h" | 28 #include "ui/gfx/size.h" |
31 #include "url/gurl.h" | 29 #include "url/gurl.h" |
32 | 30 |
33 class ExtensionAction; | 31 class ExtensionAction; |
34 class SkBitmap; | 32 class SkBitmap; |
35 | 33 |
36 namespace base { | 34 namespace base { |
37 class DictionaryValue; | 35 class DictionaryValue; |
38 class Version; | 36 class Version; |
39 } | 37 } |
40 | 38 |
41 namespace gfx { | 39 namespace gfx { |
42 class ImageSkia; | 40 class ImageSkia; |
43 } | 41 } |
44 | 42 |
45 namespace extensions { | 43 namespace extensions { |
46 class APIPermissionSet; | |
47 class ManifestPermissionSet; | |
48 class PermissionSet; | 44 class PermissionSet; |
49 class PermissionsData; | 45 class PermissionsData; |
50 class PermissionsParser; | 46 class PermissionsParser; |
51 | 47 |
52 // Uniquely identifies an Extension, using 32 characters from the alphabet | 48 // Uniquely identifies an Extension, using 32 characters from the alphabet |
53 // 'a'-'p'. An empty string represents "no extension". | 49 // 'a'-'p'. An empty string represents "no extension". |
54 // | 50 // |
55 // Note: If this gets used heavily in files that don't otherwise need to include | 51 // Note: If this gets used heavily in files that don't otherwise need to include |
56 // extension.h, we should pull it into a dedicated header. | 52 // extension.h, we should pull it into a dedicated header. |
57 typedef std::string ExtensionId; | 53 typedef std::string ExtensionId; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 239 |
244 // Expects base64 encoded |input| and formats into |output| including | 240 // Expects base64 encoded |input| and formats into |output| including |
245 // the appropriate header & footer. | 241 // the appropriate header & footer. |
246 static bool FormatPEMForFileOutput(const std::string& input, | 242 static bool FormatPEMForFileOutput(const std::string& input, |
247 std::string* output, | 243 std::string* output, |
248 bool is_public); | 244 bool is_public); |
249 | 245 |
250 // Returns the base extension url for a given |extension_id|. | 246 // Returns the base extension url for a given |extension_id|. |
251 static GURL GetBaseURLFromExtensionId(const ExtensionId& extension_id); | 247 static GURL GetBaseURLFromExtensionId(const ExtensionId& extension_id); |
252 | 248 |
253 // DEPRECATED: These methods have been moved to PermissionsData. | |
254 // TODO(rdevlin.cronin): remove these once all calls have been updated. | |
255 bool HasAPIPermission(APIPermission::ID permission) const; | |
256 bool HasAPIPermission(const std::string& permission_name) const; | |
257 scoped_refptr<const PermissionSet> GetActivePermissions() const; | |
258 | |
259 // Whether context menu should be shown for page and browser actions. | 249 // Whether context menu should be shown for page and browser actions. |
260 bool ShowConfigureContextMenus() const; | 250 bool ShowConfigureContextMenus() const; |
261 | 251 |
262 // Returns true if this extension or app includes areas within |origin|. | 252 // Returns true if this extension or app includes areas within |origin|. |
263 bool OverlapsWithOrigin(const GURL& origin) const; | 253 bool OverlapsWithOrigin(const GURL& origin) const; |
264 | 254 |
265 // Returns true if the extension requires a valid ordinal for sorting, e.g., | 255 // Returns true if the extension requires a valid ordinal for sorting, e.g., |
266 // for displaying in a launcher or new tab page. | 256 // for displaying in a launcher or new tab page. |
267 bool RequiresSortOrdinal() const; | 257 bool RequiresSortOrdinal() const; |
268 | 258 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 562 |
573 UpdatedExtensionPermissionsInfo( | 563 UpdatedExtensionPermissionsInfo( |
574 const Extension* extension, | 564 const Extension* extension, |
575 const PermissionSet* permissions, | 565 const PermissionSet* permissions, |
576 Reason reason); | 566 Reason reason); |
577 }; | 567 }; |
578 | 568 |
579 } // namespace extensions | 569 } // namespace extensions |
580 | 570 |
581 #endif // EXTENSIONS_COMMON_EXTENSION_H_ | 571 #endif // EXTENSIONS_COMMON_EXTENSION_H_ |
OLD | NEW |