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 "apps/shell/common/shell_extensions_client.h" | 5 #include "apps/shell/common/shell_extensions_client.h" |
6 | 6 |
| 7 #include "apps/shell/common/api/generated_schemas.h" |
7 #include "apps/shell/common/shell_app_runtime.h" | 8 #include "apps/shell/common/shell_app_runtime.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "chrome/common/extensions/api/generated_schemas.h" | 10 #include "chrome/common/extensions/api/generated_schemas.h" |
10 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" | 11 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" |
11 #include "extensions/common/api/generated_schemas.h" | 12 #include "extensions/common/api/generated_schemas.h" |
12 #include "extensions/common/api/sockets/sockets_manifest_handler.h" | 13 #include "extensions/common/api/sockets/sockets_manifest_handler.h" |
13 #include "extensions/common/common_manifest_handlers.h" | 14 #include "extensions/common/common_manifest_handlers.h" |
14 #include "extensions/common/features/api_feature.h" | 15 #include "extensions/common/features/api_feature.h" |
15 #include "extensions/common/features/base_feature_provider.h" | 16 #include "extensions/common/features/base_feature_provider.h" |
16 #include "extensions/common/features/json_feature_provider_source.h" | 17 #include "extensions/common/features/json_feature_provider_source.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 186 } |
186 | 187 |
187 bool ShellExtensionsClient::IsAPISchemaGenerated( | 188 bool ShellExtensionsClient::IsAPISchemaGenerated( |
188 const std::string& name) const { | 189 const std::string& name) const { |
189 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs | 190 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs |
190 // moved out. See http://crbug.com/349042. | 191 // moved out. See http://crbug.com/349042. |
191 // Special-case our simplified app.runtime implementation because we don't | 192 // Special-case our simplified app.runtime implementation because we don't |
192 // have the Chrome app APIs available. | 193 // have the Chrome app APIs available. |
193 return extensions::api::GeneratedSchemas::IsGenerated(name) || | 194 return extensions::api::GeneratedSchemas::IsGenerated(name) || |
194 extensions::core_api::GeneratedSchemas::IsGenerated(name) || | 195 extensions::core_api::GeneratedSchemas::IsGenerated(name) || |
| 196 apps::shell_api::GeneratedSchemas::IsGenerated(name) || |
195 name == extensions::ShellAppRuntime::GetName(); | 197 name == extensions::ShellAppRuntime::GetName(); |
196 } | 198 } |
197 | 199 |
198 base::StringPiece ShellExtensionsClient::GetAPISchema( | 200 base::StringPiece ShellExtensionsClient::GetAPISchema( |
199 const std::string& name) const { | 201 const std::string& name) const { |
200 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs | 202 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs |
201 // moved out. See http://crbug.com/349042. | 203 // moved out. See http://crbug.com/349042. |
202 if (extensions::api::GeneratedSchemas::IsGenerated(name)) | 204 if (extensions::api::GeneratedSchemas::IsGenerated(name)) |
203 return extensions::api::GeneratedSchemas::Get(name); | 205 return extensions::api::GeneratedSchemas::Get(name); |
204 | 206 |
| 207 // Schema for chrome.shell APIs. |
| 208 if (apps::shell_api::GeneratedSchemas::IsGenerated(name)) |
| 209 return apps::shell_api::GeneratedSchemas::Get(name); |
| 210 |
205 // Special-case our simplified app.runtime implementation. | 211 // Special-case our simplified app.runtime implementation. |
| 212 // TODO(jamescook): Move this into a chrome.shell.onLaunched() event. |
206 if (name == extensions::ShellAppRuntime::GetName()) | 213 if (name == extensions::ShellAppRuntime::GetName()) |
207 return extensions::ShellAppRuntime::GetSchema(); | 214 return extensions::ShellAppRuntime::GetSchema(); |
208 | 215 |
209 return extensions::core_api::GeneratedSchemas::Get(name); | 216 return extensions::core_api::GeneratedSchemas::Get(name); |
210 } | 217 } |
211 | 218 |
212 bool ShellExtensionsClient::ShouldSuppressFatalErrors() const { return true; } | 219 bool ShellExtensionsClient::ShouldSuppressFatalErrors() const { return true; } |
213 | 220 |
214 } // namespace apps | 221 } // namespace apps |
OLD | NEW |