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

Unified Diff: content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h

Issue 938403005: Make it possible for a navigator.connect service to receive messages as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-pass-flag
Patch Set: mention bug Created 5 years, 10 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: content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h
diff --git a/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h b/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..e153922b1511936be8dfe886b58221bebdb5e3a6
--- /dev/null
+++ b/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h
@@ -0,0 +1,40 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NAVIGATOR_CONNECT_SERVICE_FACTORY_H_
+#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NAVIGATOR_CONNECT_SERVICE_FACTORY_H_
+
+#include <map>
+#include <string>
+
+#include "content/public/browser/navigator_connect_service_factory.h"
+
+namespace content {
+
+// Implementation of NavigatorConnectServiceFactory that provides services
+// layout tests can connect to under the chrome-layout-test: schema.
+// In particular this implements an 'echo' service, that just sends back any
+// message sends to it, and an 'annotate' service, which sends back some extra
+// metadata in addition to the message it received.
+class LayoutTestNavigatorConnectServiceFactory
+ : public NavigatorConnectServiceFactory {
+ public:
+ LayoutTestNavigatorConnectServiceFactory();
+ ~LayoutTestNavigatorConnectServiceFactory() override;
+
+ // NavigatorConnectServiceFactory implementation.
+ bool HandlesUrl(const GURL& target_url) override;
+ void Connect(const NavigatorConnectClient& client,
+ const ConnectCallback& callback) override;
+
+ private:
+ // |service_| is created and destroyed on the IO thread, while
+ // LayoutTestNavigatorConnectServiceFactory can be destroyed on any thread.
+ class Service;
+ Service* service_;
+};
+
+} // namespace content
+
+#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NAVIGATOR_CONNECT_SERVICE_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698