Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: extensions/browser/mojo/service_registration_manager.h

Issue 652313002: Enable the mojo-based serial API in the renderer behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-js-natives-registration
Patch Set: fix windows build Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/mojo/service_registration_manager.h
diff --git a/extensions/browser/mojo/service_registration_manager.h b/extensions/browser/mojo/service_registration_manager.h
index c7d14c6209a8cebe41bb54100de5b7eb85890907..5fed206b4e37cff991289bd2a54b4e7f9a91bad3 100644
--- a/extensions/browser/mojo/service_registration_manager.h
+++ b/extensions/browser/mojo/service_registration_manager.h
@@ -19,6 +19,7 @@ class RenderFrameHost;
}
namespace extensions {
+
namespace internal {
// A base class for forwarding calls to ServiceRegistry::AddService().
@@ -28,6 +29,8 @@ class ServiceFactoryBase {
// Add this service factory to |service_registry|.
virtual void Register(content::ServiceRegistry* service_registry) const = 0;
+
+ virtual std::string GetName() const = 0;
};
template <typename Interface>
@@ -42,6 +45,8 @@ class ServiceFactory : public ServiceFactoryBase {
service_registry->AddService(factory_);
}
+ std::string GetName() const override { return Interface::Name_; }
+
private:
const base::Callback<void(mojo::InterfaceRequest<Interface>)> factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceFactory);
@@ -57,7 +62,7 @@ class ServiceFactory : public ServiceFactoryBase {
class ServiceRegistrationManager {
public:
ServiceRegistrationManager();
- ~ServiceRegistrationManager();
+ virtual ~ServiceRegistrationManager();
static ServiceRegistrationManager* GetSharedInstance();
@@ -84,7 +89,17 @@ class ServiceRegistrationManager {
// ServiceRegistry.
void AddServicesToRenderFrame(content::RenderFrameHost* render_frame_host);
+ protected:
+ virtual void AddServiceToServiceRegistry(
+ content::ServiceRegistry* service_registry,
+ internal::ServiceFactoryBase* service_factory);
+
private:
+ friend class TestServiceRegistrationManager;
+
+ static void SetServiceRegistrationManagerForTest(
+ ServiceRegistrationManager* service_registration_manager);
+
// All factories and their corresponding API permissions.
std::vector<std::pair<std::string, linked_ptr<internal::ServiceFactoryBase>>>
factories_;
« no previous file with comments | « extensions/browser/api/serial/serial_apitest.cc ('k') | extensions/browser/mojo/service_registration_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698