OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2817 return false; | 2817 return false; |
2818 origin_only_pattern.SetHost(origin.host()); | 2818 origin_only_pattern.SetHost(origin.host()); |
2819 origin_only_pattern.SetPath("/*"); | 2819 origin_only_pattern.SetPath("/*"); |
2820 | 2820 |
2821 URLPatternSet origin_only_pattern_list; | 2821 URLPatternSet origin_only_pattern_list; |
2822 origin_only_pattern_list.AddPattern(origin_only_pattern); | 2822 origin_only_pattern_list.AddPattern(origin_only_pattern); |
2823 | 2823 |
2824 return web_extent().OverlapsWith(origin_only_pattern_list); | 2824 return web_extent().OverlapsWith(origin_only_pattern_list); |
2825 } | 2825 } |
2826 | 2826 |
2827 Extension::SyncType Extension::GetSyncType() const { | |
2828 // TODO(akalin): Figure out if we need to allow some other types. | |
2829 if (location() != Extension::INTERNAL) { | |
2830 // We have a non-standard location. | |
2831 return SYNC_TYPE_NONE; | |
2832 } | |
2833 | |
2834 // Disallow extensions with non-gallery auto-update URLs for now. | |
2835 // | |
2836 // TODO(akalin): Relax this restriction once we've put in UI to | |
2837 // approve synced extensions. | |
2838 if (!update_url().is_empty() && | |
2839 (update_url() != GalleryUpdateUrl(false)) && | |
2840 (update_url() != GalleryUpdateUrl(true))) { | |
2841 return SYNC_TYPE_NONE; | |
2842 } | |
2843 | |
2844 // Disallow extensions with native code plugins. | |
2845 // | |
2846 // TODO(akalin): Relax this restriction once we've put in UI to | |
2847 // approve synced extensions. | |
2848 if (!plugins().empty()) { | |
2849 return SYNC_TYPE_NONE; | |
2850 } | |
2851 | |
2852 switch (GetType()) { | |
2853 case Extension::TYPE_EXTENSION: | |
2854 return SYNC_TYPE_EXTENSION; | |
2855 | |
2856 case Extension::TYPE_USER_SCRIPT: | |
2857 // We only want to sync user scripts with update URLs. | |
akalin
2011/08/12 03:35:02
clarify that we want to sync user scripts with gal
| |
2858 if (update_url().is_empty()) | |
2859 return SYNC_TYPE_NONE; | |
2860 else | |
2861 return SYNC_TYPE_EXTENSION; | |
2862 | |
2863 case Extension::TYPE_HOSTED_APP: | |
2864 case Extension::TYPE_PACKAGED_APP: | |
2865 return SYNC_TYPE_APP; | |
2866 | |
2867 default: | |
2868 return SYNC_TYPE_NONE; | |
2869 } | |
2870 } | |
2871 | |
2827 ExtensionInfo::ExtensionInfo(const DictionaryValue* manifest, | 2872 ExtensionInfo::ExtensionInfo(const DictionaryValue* manifest, |
2828 const std::string& id, | 2873 const std::string& id, |
2829 const FilePath& path, | 2874 const FilePath& path, |
2830 Extension::Location location) | 2875 Extension::Location location) |
2831 : extension_id(id), | 2876 : extension_id(id), |
2832 extension_path(path), | 2877 extension_path(path), |
2833 extension_location(location) { | 2878 extension_location(location) { |
2834 if (manifest) | 2879 if (manifest) |
2835 extension_manifest.reset(manifest->DeepCopy()); | 2880 extension_manifest.reset(manifest->DeepCopy()); |
2836 } | 2881 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2870 already_disabled(false), | 2915 already_disabled(false), |
2871 extension(extension) {} | 2916 extension(extension) {} |
2872 | 2917 |
2873 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 2918 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
2874 const Extension* extension, | 2919 const Extension* extension, |
2875 const ExtensionPermissionSet* permissions, | 2920 const ExtensionPermissionSet* permissions, |
2876 Reason reason) | 2921 Reason reason) |
2877 : reason(reason), | 2922 : reason(reason), |
2878 extension(extension), | 2923 extension(extension), |
2879 permissions(permissions) {} | 2924 permissions(permissions) {} |
OLD | NEW |