OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "mojo/public/cpp/bindings/interface_request.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 #include "third_party/WebKit/public/platform/resource_hints.mojom.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class RenderProcessHost; |
| 17 class ResourceContext; |
| 18 |
| 19 // Listeners for resource hints requests from a frame in the render process. |
| 20 class ResourceHintsHandlerImpl : public blink::mojom::ResourceHintsHandler { |
| 21 public: |
| 22 // |controller| and |resource_context| must outlive this class. |
| 23 ResourceHintsHandlerImpl(blink::mojom::ResourceHintsHandlerRequest request, |
| 24 ResourceContext* resource_context); |
| 25 |
| 26 ~ResourceHintsHandlerImpl() override; |
| 27 |
| 28 // blink::mojom::ResourceHintsHandler: |
| 29 void Preresolve(const GURL& url) override; |
| 30 void Preconnect(const GURL& url, |
| 31 bool credentials_flag, |
| 32 uint8_t num_connections) override; |
| 33 |
| 34 static void RegisterConnection( |
| 35 RenderProcessHost* render_process_host, |
| 36 blink::mojom::ResourceHintsHandlerRequest request); |
| 37 |
| 38 private: |
| 39 static void RegisterConnectionOnIOThread( |
| 40 ResourceContext* resource_context, |
| 41 blink::mojom::ResourceHintsHandlerRequest request); |
| 42 ResourceContext* resource_context_; |
| 43 mojo::StrongBinding<blink::mojom::ResourceHintsHandler> binding_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(ResourceHintsHandlerImpl); |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_ |
OLD | NEW |