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/base_feature_provider.h" | 15 #include "extensions/common/features/base_feature_provider.h" |
15 #include "extensions/common/manifest_handler.h" | 16 #include "extensions/common/manifest_handler.h" |
16 #include "extensions/common/permissions/permission_message_provider.h" | 17 #include "extensions/common/permissions/permission_message_provider.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 153 } |
153 | 154 |
154 bool ShellExtensionsClient::IsAPISchemaGenerated( | 155 bool ShellExtensionsClient::IsAPISchemaGenerated( |
155 const std::string& name) const { | 156 const std::string& name) const { |
156 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs | 157 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs |
157 // moved out. See http://crbug.com/349042. | 158 // moved out. See http://crbug.com/349042. |
158 // Special-case our simplified app.runtime implementation because we don't | 159 // Special-case our simplified app.runtime implementation because we don't |
159 // have the Chrome app APIs available. | 160 // have the Chrome app APIs available. |
160 return extensions::api::GeneratedSchemas::IsGenerated(name) || | 161 return extensions::api::GeneratedSchemas::IsGenerated(name) || |
161 extensions::core_api::GeneratedSchemas::IsGenerated(name) || | 162 extensions::core_api::GeneratedSchemas::IsGenerated(name) || |
| 163 apps::shell_api::GeneratedSchemas::IsGenerated(name) || |
162 name == extensions::ShellAppRuntime::GetName(); | 164 name == extensions::ShellAppRuntime::GetName(); |
163 } | 165 } |
164 | 166 |
165 base::StringPiece ShellExtensionsClient::GetAPISchema( | 167 base::StringPiece ShellExtensionsClient::GetAPISchema( |
166 const std::string& name) const { | 168 const std::string& name) const { |
167 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs | 169 // TODO(rockot): Remove dependency on src/chrome once we have some core APIs |
168 // moved out. See http://crbug.com/349042. | 170 // moved out. See http://crbug.com/349042. |
169 if (extensions::api::GeneratedSchemas::IsGenerated(name)) | 171 if (extensions::api::GeneratedSchemas::IsGenerated(name)) |
170 return extensions::api::GeneratedSchemas::Get(name); | 172 return extensions::api::GeneratedSchemas::Get(name); |
171 | 173 |
| 174 // Schema for chrome.shell APIs. |
| 175 if (apps::shell_api::GeneratedSchemas::IsGenerated(name)) |
| 176 return apps::shell_api::GeneratedSchemas::Get(name); |
| 177 |
172 // Special-case our simplified app.runtime implementation. | 178 // Special-case our simplified app.runtime implementation. |
| 179 // TODO(jamescook): Move this into a chrome.shell.onLaunched() event. |
173 if (name == extensions::ShellAppRuntime::GetName()) | 180 if (name == extensions::ShellAppRuntime::GetName()) |
174 return extensions::ShellAppRuntime::GetSchema(); | 181 return extensions::ShellAppRuntime::GetSchema(); |
175 | 182 |
176 return extensions::core_api::GeneratedSchemas::Get(name); | 183 return extensions::core_api::GeneratedSchemas::Get(name); |
177 } | 184 } |
178 | 185 |
179 void ShellExtensionsClient::AddExtraFeatureFilters( | 186 void ShellExtensionsClient::AddExtraFeatureFilters( |
180 extensions::SimpleFeature* feature) const {} | 187 extensions::SimpleFeature* feature) const {} |
181 | 188 |
182 bool ShellExtensionsClient::ShouldSuppressFatalErrors() const { return true; } | 189 bool ShellExtensionsClient::ShouldSuppressFatalErrors() const { return true; } |
183 | 190 |
184 } // namespace apps | 191 } // namespace apps |
OLD | NEW |