| 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 "extensions/common/extension_api.h" | 5 #include "extensions/common/extension_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 return true; | 260 return true; |
| 261 } | 261 } |
| 262 return false; | 262 return false; |
| 263 } | 263 } |
| 264 | 264 |
| 265 Feature::Availability ExtensionAPI::IsAvailable(const std::string& full_name, | 265 Feature::Availability ExtensionAPI::IsAvailable(const std::string& full_name, |
| 266 const Extension* extension, | 266 const Extension* extension, |
| 267 Feature::Context context, | 267 Feature::Context context, |
| 268 const GURL& url) { | 268 const GURL& url) { |
| 269 Feature* feature = GetFeatureDependency(full_name); | 269 Feature* feature = GetFeatureDependency(full_name); |
| 270 CHECK(feature) << full_name; | 270 if (!feature) { |
| 271 return Feature::CreateAvailability(Feature::NOT_PRESENT, |
| 272 std::string("Unknown feature: ") + full_name); |
| 273 } |
| 271 return IsAvailable(*feature, extension, context, url); | 274 return IsAvailable(*feature, extension, context, url); |
| 272 } | 275 } |
| 273 | 276 |
| 274 Feature::Availability ExtensionAPI::IsAvailable(const Feature& feature, | 277 Feature::Availability ExtensionAPI::IsAvailable(const Feature& feature, |
| 275 const Extension* extension, | 278 const Extension* extension, |
| 276 Feature::Context context, | 279 Feature::Context context, |
| 277 const GURL& url) { | 280 const GURL& url) { |
| 278 Feature::Availability availability = | 281 Feature::Availability availability = |
| 279 feature.IsAvailableToContext(extension, context, url); | 282 feature.IsAvailableToContext(extension, context, url); |
| 280 if (!availability.is_available()) | 283 if (!availability.is_available()) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 break; | 387 break; |
| 385 | 388 |
| 386 api_name_candidate = api_name_candidate.substr(0, last_dot_index); | 389 api_name_candidate = api_name_candidate.substr(0, last_dot_index); |
| 387 } | 390 } |
| 388 | 391 |
| 389 *child_name = ""; | 392 *child_name = ""; |
| 390 return std::string(); | 393 return std::string(); |
| 391 } | 394 } |
| 392 | 395 |
| 393 } // namespace extensions | 396 } // namespace extensions |
| OLD | NEW |