Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_SERVICE_REGISTRY_JS_WRAPPER_H_ | |
| 6 #define CONTENT_RENDERER_SERVICE_REGISTRY_JS_WRAPPER_H_ | |
|
darin (slow to review)
2014/06/28 21:10:38
should this be in content/renderer/mojo/ ?
Sam McNally
2014/06/30 01:26:14
Done.
| |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "content/public/renderer/service_registry_js.h" | |
| 12 #include "gin/handle.h" | |
| 13 #include "gin/object_template_builder.h" | |
| 14 #include "gin/wrappable.h" | |
| 15 #include "mojo/public/cpp/system/core.h" | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 class ServiceRegistry; | |
| 20 | |
| 21 // A JS wrapper around ServiceRegistry that allows connecting to remote | |
| 22 // services. | |
| 23 class CONTENT_EXPORT ServiceRegistryJsWrapper | |
| 24 : public gin::Wrappable<ServiceRegistryJsWrapper> { | |
| 25 public: | |
| 26 virtual ~ServiceRegistryJsWrapper(); | |
| 27 static gin::Handle<ServiceRegistryJsWrapper> Create( | |
| 28 v8::Isolate* isolate, | |
| 29 base::WeakPtr<ServiceRegistry> service_registry); | |
| 30 | |
| 31 // gin::Wrappable<ServiceRegistryJsWrapper> overrides. | |
| 32 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | |
| 33 v8::Isolate* isolate) OVERRIDE; | |
| 34 | |
| 35 // JS interface implementation. | |
| 36 mojo::Handle ConnectToService(const std::string& service_name); | |
| 37 | |
| 38 static gin::WrapperInfo kWrapperInfo; | |
| 39 | |
| 40 private: | |
| 41 explicit ServiceRegistryJsWrapper( | |
| 42 base::WeakPtr<ServiceRegistry> service_registry); | |
| 43 | |
| 44 base::WeakPtr<ServiceRegistry> service_registry_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryJsWrapper); | |
| 47 }; | |
| 48 | |
| 49 } // namespace content | |
| 50 | |
| 51 #endif // CONTENT_RENDERER_SERVICE_REGISTRY_JS_WRAPPER_H_ | |
| OLD | NEW |