| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" | 5 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 8 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "chrome/common/extensions/api/manifest_types.h" | 11 #include "chrome/common/extensions/api/manifest_types.h" |
| 11 #include "extensions/common/error_utils.h" | 12 #include "extensions/common/error_utils.h" |
| 12 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
| 13 #include "extensions/common/manifest_handlers/permissions_parser.h" | 14 #include "extensions/common/manifest_handlers/permissions_parser.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_DEVICE: | 93 case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_DEVICE: |
| 93 source = SOURCE_DEVICE; | 94 source = SOURCE_DEVICE; |
| 94 break; | 95 break; |
| 95 case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NETWORK: | 96 case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NETWORK: |
| 96 source = SOURCE_NETWORK; | 97 source = SOURCE_NETWORK; |
| 97 break; | 98 break; |
| 98 case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NONE: | 99 case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NONE: |
| 99 NOTREACHED(); | 100 NOTREACHED(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 scoped_ptr<FileSystemProviderCapabilities> capabilities( | 103 std::unique_ptr<FileSystemProviderCapabilities> capabilities( |
| 103 new FileSystemProviderCapabilities( | 104 new FileSystemProviderCapabilities( |
| 104 idl_capabilities.configurable.get() | 105 idl_capabilities.configurable.get() |
| 105 ? *idl_capabilities.configurable.get() | 106 ? *idl_capabilities.configurable.get() |
| 106 : false /* false by default */, | 107 : false /* false by default */, |
| 107 idl_capabilities.watchable.get() ? *idl_capabilities.watchable.get() | 108 idl_capabilities.watchable.get() ? *idl_capabilities.watchable.get() |
| 108 : false /* false by default */, | 109 : false /* false by default */, |
| 109 idl_capabilities.multiple_mounts.get() | 110 idl_capabilities.multiple_mounts.get() |
| 110 ? *idl_capabilities.multiple_mounts.get() | 111 ? *idl_capabilities.multiple_mounts.get() |
| 111 : false /* false by default */, | 112 : false /* false by default */, |
| 112 source)); | 113 source)); |
| 113 | 114 |
| 114 extension->SetManifestData(manifest_keys::kFileSystemProviderCapabilities, | 115 extension->SetManifestData(manifest_keys::kFileSystemProviderCapabilities, |
| 115 capabilities.release()); | 116 capabilities.release()); |
| 116 return true; | 117 return true; |
| 117 } | 118 } |
| 118 | 119 |
| 119 const std::vector<std::string> FileSystemProviderCapabilitiesHandler::Keys() | 120 const std::vector<std::string> FileSystemProviderCapabilitiesHandler::Keys() |
| 120 const { | 121 const { |
| 121 return SingleKey(manifest_keys::kFileSystemProviderCapabilities); | 122 return SingleKey(manifest_keys::kFileSystemProviderCapabilities); |
| 122 } | 123 } |
| 123 | 124 |
| 124 bool FileSystemProviderCapabilitiesHandler::AlwaysParseForType( | 125 bool FileSystemProviderCapabilitiesHandler::AlwaysParseForType( |
| 125 Manifest::Type type) const { | 126 Manifest::Type type) const { |
| 126 return true; | 127 return true; |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace extensions | 130 } // namespace extensions |
| OLD | NEW |