OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 v8::Context::Scope context_scope(context->v8_context()); | 996 v8::Context::Scope context_scope(context->v8_context()); |
997 | 997 |
998 // TODO(kalman): Make the bindings registration have zero overhead then run | 998 // TODO(kalman): Make the bindings registration have zero overhead then run |
999 // the same code regardless of context type. | 999 // the same code regardless of context type. |
1000 switch (context->context_type()) { | 1000 switch (context->context_type()) { |
1001 case Feature::UNSPECIFIED_CONTEXT: | 1001 case Feature::UNSPECIFIED_CONTEXT: |
1002 case Feature::WEB_PAGE_CONTEXT: | 1002 case Feature::WEB_PAGE_CONTEXT: |
1003 case Feature::BLESSED_WEB_PAGE_CONTEXT: { | 1003 case Feature::BLESSED_WEB_PAGE_CONTEXT: { |
1004 // Web page context; it's too expensive to run the full bindings code. | 1004 // Web page context; it's too expensive to run the full bindings code. |
1005 // Hard-code that the app and webstore APIs are available... | 1005 // Hard-code that the app and webstore APIs are available... |
1006 RegisterBinding("app", context); | 1006 if (context->GetAvailability("app").is_available()) |
1007 RegisterBinding("webstore", context); | 1007 RegisterBinding("app", context); |
| 1008 |
| 1009 if (context->GetAvailability("webstore").is_available()) |
| 1010 RegisterBinding("webstore", context); |
1008 | 1011 |
1009 // ... and that the runtime API might be available if any extension can | 1012 // ... and that the runtime API might be available if any extension can |
1010 // connect to it. | 1013 // connect to it. |
1011 bool runtime_is_available = false; | 1014 bool runtime_is_available = false; |
1012 for (ExtensionSet::const_iterator it = extensions_.begin(); | 1015 for (ExtensionSet::const_iterator it = extensions_.begin(); |
1013 it != extensions_.end(); | 1016 it != extensions_.end(); |
1014 ++it) { | 1017 ++it) { |
1015 ExternallyConnectableInfo* info = | 1018 ExternallyConnectableInfo* info = |
1016 static_cast<ExternallyConnectableInfo*>( | 1019 static_cast<ExternallyConnectableInfo*>( |
1017 (*it)->GetManifestData(manifest_keys::kExternallyConnectable)); | 1020 (*it)->GetManifestData(manifest_keys::kExternallyConnectable)); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 return v8::Handle<v8::Object>(); | 1288 return v8::Handle<v8::Object>(); |
1286 | 1289 |
1287 if (bind_name) | 1290 if (bind_name) |
1288 *bind_name = split.back(); | 1291 *bind_name = split.back(); |
1289 | 1292 |
1290 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1293 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1291 : bind_object; | 1294 : bind_object; |
1292 } | 1295 } |
1293 | 1296 |
1294 } // namespace extensions | 1297 } // namespace extensions |
OLD | NEW |