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

Unified Diff: extensions/browser/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: rebase 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/service_registration_manager.h
diff --git a/extensions/browser/service_registration_manager.h b/extensions/browser/service_registration_manager.h
index aab91e7aaf58c85da1d55cc0918eafc6352cf7f3..ad0d974b14051e040fdd738b701ab85ac6feb5ab 100644
--- a/extensions/browser/service_registration_manager.h
+++ b/extensions/browser/service_registration_manager.h
@@ -19,6 +19,9 @@ class RenderFrameHost;
}
namespace extensions {
+
+class ServiceRegistrationManagerTestApi;
+
namespace internal {
// A base class for forwarding calls to ServiceRegistry::AddService().
@@ -28,6 +31,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>
@@ -43,6 +48,8 @@ class ServiceFactory : public ServiceFactoryBase {
service_registry->AddService(factory_);
}
+ virtual std::string GetName() const override { return Interface::Name_; }
+
private:
const base::Callback<void(mojo::InterfaceRequest<Interface>)> factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceFactory);
@@ -82,7 +89,18 @@ 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 ServiceRegistrationManagerTestApi;
+
+ static void SetServiceRegistrationManagerForTest(
+ ServiceRegistrationManager* service_registration_manager);
+ static void ClearServiceRegistrationManagerForTest();
+
// All factories and their corresponding API permissions.
std::vector<std::pair<std::string, linked_ptr<internal::ServiceFactoryBase>>>
factories_;

Powered by Google App Engine
This is Rietveld 408576698