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/chrome_extensions_client.h" | 5 #include "chrome/common/extensions/chrome_extensions_client.h" |
6 | 6 |
| 7 #include "apps/common/api/generated_schemas.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "chrome/common/extensions/api/generated_schemas.h" | 9 #include "chrome/common/extensions/api/generated_schemas.h" |
9 #include "chrome/common/extensions/chrome_manifest_handlers.h" | 10 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
10 #include "chrome/common/extensions/extension_constants.h" | 11 #include "chrome/common/extensions/extension_constants.h" |
11 #include "chrome/common/extensions/features/base_feature_provider.h" | 12 #include "chrome/common/extensions/features/base_feature_provider.h" |
12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
13 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
14 #include "extensions/common/api/generated_schemas.h" | 15 #include "extensions/common/api/generated_schemas.h" |
15 #include "extensions/common/common_manifest_handlers.h" | 16 #include "extensions/common/common_manifest_handlers.h" |
16 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (url.host() == store_url.host()) { | 148 if (url.host() == store_url.host()) { |
148 if (error) | 149 if (error) |
149 *error = manifest_errors::kCannotScriptGallery; | 150 *error = manifest_errors::kCannotScriptGallery; |
150 return false; | 151 return false; |
151 } | 152 } |
152 return true; | 153 return true; |
153 } | 154 } |
154 | 155 |
155 bool ChromeExtensionsClient::IsAPISchemaGenerated( | 156 bool ChromeExtensionsClient::IsAPISchemaGenerated( |
156 const std::string& name) const { | 157 const std::string& name) const { |
| 158 // Test from most common to least common. |
157 return extensions::api::GeneratedSchemas::IsGenerated(name) || | 159 return extensions::api::GeneratedSchemas::IsGenerated(name) || |
158 extensions::core_api::GeneratedSchemas::IsGenerated(name); | 160 extensions::core_api::GeneratedSchemas::IsGenerated(name) || |
| 161 apps::api::GeneratedSchemas::IsGenerated(name); |
159 } | 162 } |
160 | 163 |
161 base::StringPiece ChromeExtensionsClient::GetAPISchema( | 164 base::StringPiece ChromeExtensionsClient::GetAPISchema( |
162 const std::string& name) const { | 165 const std::string& name) const { |
| 166 // Test from most common to least common. |
163 if (extensions::api::GeneratedSchemas::IsGenerated(name)) | 167 if (extensions::api::GeneratedSchemas::IsGenerated(name)) |
164 return extensions::api::GeneratedSchemas::Get(name); | 168 return extensions::api::GeneratedSchemas::Get(name); |
165 return extensions::core_api::GeneratedSchemas::Get(name); | 169 |
| 170 if (extensions::core_api::GeneratedSchemas::IsGenerated(name)) |
| 171 return extensions::core_api::GeneratedSchemas::Get(name); |
| 172 |
| 173 return apps::api::GeneratedSchemas::Get(name); |
166 } | 174 } |
167 | 175 |
168 // static | 176 // static |
169 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { | 177 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { |
170 return g_client.Pointer(); | 178 return g_client.Pointer(); |
171 } | 179 } |
172 | 180 |
173 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |