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/binding.h" |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "net/base/completion_callback.h" |
| 12 #include "third_party/WebKit/public/platform/resource_hints.mojom.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 class RenderProcessHost; |
| 18 class ResourceContext; |
| 19 |
| 20 // Listeners for resource hints requests from a frame in the render process. |
| 21 class ResourceHintsController |
| 22 : public blink::mojom::ResourceHintsDispatcherHost { |
| 23 public: |
| 24 // |controller| and |resource_context| must outlive this class. |
| 25 ResourceHintsController( |
| 26 mojo::InterfaceRequest<blink::mojom::ResourceHintsDispatcherHost> request, |
| 27 ResourceContext* resource_context); |
| 28 |
| 29 ~ResourceHintsController() override; |
| 30 |
| 31 // blink::mojom::ResourceHintsDispatcherHost: |
| 32 void DispatchPreresolve(const GURL& url) override; |
| 33 void DispatchPreconnect(const GURL& url, |
| 34 bool credentials_flag, |
| 35 uint8_t num_connections) override; |
| 36 |
| 37 void HostHadConnectionError(); |
| 38 |
| 39 static void RegisterConnection( |
| 40 RenderProcessHost* render_process_host, |
| 41 mojo::InterfaceRequest<blink::mojom::ResourceHintsDispatcherHost> |
| 42 request); |
| 43 |
| 44 private: |
| 45 static void RegisterConnectionOnIOThread( |
| 46 ResourceContext* resource_context, |
| 47 mojo::InterfaceRequest<blink::mojom::ResourceHintsDispatcherHost> |
| 48 request); |
| 49 ResourceContext* resource_context_; |
| 50 mojo::Binding<blink::mojom::ResourceHintsDispatcherHost> binding_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(ResourceHintsController); |
| 53 }; |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HINTS_CONTROLLER_H_ |
OLD | NEW |