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

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: 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..775053ff8318f83b02b698f4b056102abbbe9079
--- /dev/null
+++ b/content/browser/loader/resource_hints_controller.h
@@ -0,0 +1,57 @@
+// 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/binding.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "net/base/completion_callback.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::ResourceHintsDispatcherHost {
+ public:
+ // |controller| and |resource_context| must outlive this class.
+ ResourceHintsController(
+ mojo::InterfaceRequest<blink::mojom::ResourceHintsDispatcherHost> request,
+ ResourceContext* resource_context);
+
+ ~ResourceHintsController() override;
+
+ // blink::mojom::ResourceHintsDispatcherHost:
+ void DispatchPreresolve(const GURL& url) override;
+ void DispatchPreconnect(const GURL& url,
+ bool credentials_flag,
+ uint8_t num_connections) override;
+
+ void HostHadConnectionError();
+
+ static void RegisterConnection(
+ RenderProcessHost* render_process_host,
+ mojo::InterfaceRequest<blink::mojom::ResourceHintsDispatcherHost>
+ request);
+
+ private:
+ static void RegisterConnectionOnIOThread(
+ ResourceContext* resource_context,
+ mojo::InterfaceRequest<blink::mojom::ResourceHintsDispatcherHost>
+ request);
+ ResourceContext* resource_context_;
+ mojo::Binding<blink::mojom::ResourceHintsDispatcherHost> 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