| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/common/extensions/sync_helper.h" | 5 #include "chrome/common/extensions/sync_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 8 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
| 9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
| 10 #include "chrome/common/extensions/extension_constants.h" | 10 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // approve synced extensions. | 34 // approve synced extensions. |
| 35 if (!ManifestURL::GetUpdateURL(extension).is_empty() && | 35 if (!ManifestURL::GetUpdateURL(extension).is_empty() && |
| 36 !ManifestURL::UpdatesFromGallery(extension)) { | 36 !ManifestURL::UpdatesFromGallery(extension)) { |
| 37 return SYNC_TYPE_NONE; | 37 return SYNC_TYPE_NONE; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Disallow extensions with native code plugins. | 40 // Disallow extensions with native code plugins. |
| 41 // | 41 // |
| 42 // TODO(akalin): Relax this restriction once we've put in UI to | 42 // TODO(akalin): Relax this restriction once we've put in UI to |
| 43 // approve synced extensions. | 43 // approve synced extensions. |
| 44 if (PluginInfo::HasPlugins(extension)) | 44 if (PluginInfo::HasPlugins(extension) || |
| 45 extension->HasAPIPermission(APIPermission::kPlugin)) { |
| 45 return SYNC_TYPE_NONE; | 46 return SYNC_TYPE_NONE; |
| 47 } |
| 46 | 48 |
| 47 switch (extension->GetType()) { | 49 switch (extension->GetType()) { |
| 48 case Manifest::TYPE_EXTENSION: | 50 case Manifest::TYPE_EXTENSION: |
| 49 return SYNC_TYPE_EXTENSION; | 51 return SYNC_TYPE_EXTENSION; |
| 50 | 52 |
| 51 case Manifest::TYPE_USER_SCRIPT: | 53 case Manifest::TYPE_USER_SCRIPT: |
| 52 // We only want to sync user scripts with gallery update URLs. | 54 // We only want to sync user scripts with gallery update URLs. |
| 53 if (ManifestURL::UpdatesFromGallery(extension)) | 55 if (ManifestURL::UpdatesFromGallery(extension)) |
| 54 return SYNC_TYPE_EXTENSION; | 56 return SYNC_TYPE_EXTENSION; |
| 55 return SYNC_TYPE_NONE; | 57 return SYNC_TYPE_NONE; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 bool IsSyncableExtension(const Extension* extension) { | 91 bool IsSyncableExtension(const Extension* extension) { |
| 90 return GetSyncType(extension) == SYNC_TYPE_EXTENSION; | 92 return GetSyncType(extension) == SYNC_TYPE_EXTENSION; |
| 91 } | 93 } |
| 92 | 94 |
| 93 bool IsSyncableApp(const Extension* extension) { | 95 bool IsSyncableApp(const Extension* extension) { |
| 94 return GetSyncType(extension) == SYNC_TYPE_APP; | 96 return GetSyncType(extension) == SYNC_TYPE_APP; |
| 95 } | 97 } |
| 96 | 98 |
| 97 } // namespace sync_helper | 99 } // namespace sync_helper |
| 98 } // namespace extensions | 100 } // namespace extensions |
| OLD | NEW |