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

Side by Side Diff: components/network_hints/browser/network_hints_impl.h

Issue 2144533002: Convert network hints to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add untracked dependency on mojom Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_ 5 #ifndef COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_
6 #define COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_ 6 #define COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "content/public/browser/browser_message_filter.h" 9 #include "components/network_hints/public/interfaces/network_hints.mojom.h"
10 #include "mojo/public/cpp/bindings/binding_set.h"
10 11
11 namespace net { 12 namespace net {
12 class HostResolver; 13 class HostResolver;
13 } 14 }
14 15
15 namespace network_hints { 16 namespace network_hints {
16 struct LookupRequest; 17 struct LookupRequest;
17 18
18 // Simple browser-side handler for DNS prefetch requests. 19 // Simple browser-side handler for DNS prefetch requests.
19 // Passes prefetch requests to the provided net::HostResolver. 20 // Passes prefetch requests to the provided net::HostResolver.
20 // Each renderer process requires its own filter. 21 // Each renderer process requires its own filter.
21 class NetworkHintsMessageFilter : public content::BrowserMessageFilter { 22 class NetworkHintsImpl : public network_hints::mojom::NetworkHints {
22 public: 23 public:
23 explicit NetworkHintsMessageFilter(net::HostResolver* host_resolver); 24 explicit NetworkHintsImpl(net::HostResolver* host_resolver);
25 ~NetworkHintsImpl() override;
24 26
25 // content::BrowserMessageFilter implementation: 27 void Bind(mojo::InterfaceRequest<mojom::NetworkHints> request);
26 bool OnMessageReceived(const IPC::Message& message) override;
27 28
28 private: 29 private:
29 ~NetworkHintsMessageFilter() override; 30 // network_hints::mojom::NetworkHints implementation:
30 31 void DNSPrefetch(const LookupRequest& lookup_request) override;
31 void OnDnsPrefetch(const LookupRequest& lookup_request); 32 void Preconnect(const GURL& url,
33 bool allow_credentials,
34 int32_t count) override {}
32 35
33 net::HostResolver* host_resolver_; 36 net::HostResolver* host_resolver_;
34 37
35 DISALLOW_COPY_AND_ASSIGN(NetworkHintsMessageFilter); 38 mojo::BindingSet<mojom::NetworkHints> bindings_;
39
40 DISALLOW_COPY_AND_ASSIGN(NetworkHintsImpl);
36 }; 41 };
37 42
38 } // namespace network_hints 43 } // namespace network_hints
39 44
40 #endif // COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_ 45 #endif // COMPONENTS_NETWORK_HINTS_BROWSER_NETWORK_HINTS_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698