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

Unified Diff: content/browser/loader/resource_hints_controller.h

Issue 2043753002: Declarative resource hints go through mojo IPC to //content Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use unique_ptr to avoid memory leaks in unit tests Created 4 years, 6 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/browser/loader/resource_hints_controller.h
diff --git a/content/browser/loader/resource_hints_controller.h b/content/browser/loader/resource_hints_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..4ea2f416a4be76f1d2ab131a6156ebb1e8b6d9be
--- /dev/null
+++ b/content/browser/loader/resource_hints_controller.h
@@ -0,0 +1,50 @@
+// Copyright 2016 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_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_
+#define CONTENT_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_
+
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "third_party/WebKit/public/platform/resource_hints.mojom.h"
+#include "url/gurl.h"
+
+namespace content {
+
+class RenderProcessHost;
+class ResourceContext;
+
+// Listeners for resource hints requests from a frame in the render process.
+class ResourceHintsController : public blink::mojom::ResourceHintsHandler {
kinuko 2016/06/16 05:39:58 nit: the most common naming pattern seems to be to
Charlie Harrison 2016/06/16 11:00:20 Done.
+ public:
+ // |controller| and |resource_context| must outlive this class.
+ ResourceHintsController(blink::mojom::ResourceHintsHandlerRequest request,
+ ResourceContext* resource_context);
+
+ ~ResourceHintsController() override;
+
+ // blink::mojom::ResourceHintsHandler:
+ void Preresolve(const GURL& url) override;
+ void Preconnect(const GURL& url,
+ bool credentials_flag,
+ uint8_t num_connections) override;
+
+ static void RegisterConnection(
+ RenderProcessHost* render_process_host,
+ blink::mojom::ResourceHintsHandlerRequest request);
+
+ private:
+ static void RegisterConnectionOnIOThread(
+ ResourceContext* resource_context,
+ blink::mojom::ResourceHintsHandlerRequest request);
+ ResourceContext* resource_context_;
+ mojo::StrongBinding<blink::mojom::ResourceHintsHandler> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceHintsController);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698