OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
14 #include "components/network_hints/public/interfaces/network_hints.mojom.h" | |
14 #include "content/public/browser/browser_message_filter.h" | 15 #include "content/public/browser/browser_message_filter.h" |
16 #include "mojo/public/cpp/bindings/binding_set.h" | |
15 | 17 |
16 class GURL; | 18 class GURL; |
17 class Profile; | 19 class Profile; |
18 | 20 |
19 namespace chrome_browser_net { | 21 namespace chrome_browser_net { |
20 class Predictor; | 22 class Predictor; |
21 } | 23 } |
22 | 24 |
23 namespace content_settings { | 25 namespace content_settings { |
24 class CookieSettings; | 26 class CookieSettings; |
25 } | 27 } |
26 | 28 |
27 namespace network_hints { | 29 namespace network_hints { |
28 struct LookupRequest; | 30 struct LookupRequest; |
29 } | 31 } |
30 | 32 |
31 namespace extensions { | 33 namespace extensions { |
32 class InfoMap; | 34 class InfoMap; |
33 } | 35 } |
34 | 36 |
35 // This class filters out incoming Chrome-specific IPC messages for the renderer | 37 // This class filters out incoming Chrome-specific IPC messages for the renderer |
36 // process on the IPC thread. | 38 // process on the IPC thread. |
37 class ChromeRenderMessageFilter : public content::BrowserMessageFilter { | 39 class ChromeRenderMessageFilter : public content::BrowserMessageFilter, |
40 public network_hints::mojom::NetworkHints { | |
dcheng
2016/07/20 13:59:50
Does that mean this is going to end up implementin
tibell
2016/07/21 00:12:06
Yes potentially. At some point it probably makes s
| |
38 public: | 41 public: |
39 ChromeRenderMessageFilter(int render_process_id, Profile* profile); | 42 ChromeRenderMessageFilter(int render_process_id, Profile* profile); |
40 | 43 |
41 // content::BrowserMessageFilter methods: | 44 // content::BrowserMessageFilter methods: |
42 bool OnMessageReceived(const IPC::Message& message) override; | 45 bool OnMessageReceived(const IPC::Message& message) override; |
43 void OverrideThreadForMessage(const IPC::Message& message, | 46 void OverrideThreadForMessage(const IPC::Message& message, |
44 content::BrowserThread::ID* thread) override; | 47 content::BrowserThread::ID* thread) override; |
45 | 48 |
49 void BindNetworkHints(network_hints::mojom::NetworkHintsRequest request); | |
50 | |
46 private: | 51 private: |
47 friend class content::BrowserThread; | 52 friend class content::BrowserThread; |
48 friend class base::DeleteHelper<ChromeRenderMessageFilter>; | 53 friend class base::DeleteHelper<ChromeRenderMessageFilter>; |
49 | 54 |
50 ~ChromeRenderMessageFilter() override; | 55 ~ChromeRenderMessageFilter() override; |
51 | 56 |
52 void OnDnsPrefetch(const network_hints::LookupRequest& request); | 57 // mojom::NetworkHints methods: |
53 void OnPreconnect(const GURL& url, bool allow_credentials, int count); | 58 void DNSPrefetch(const network_hints::LookupRequest& request) override; |
59 void Preconnect(const GURL& url, bool allow_credentials, int count) override; | |
60 | |
54 void OnUpdatedCacheStats(uint64_t min_capacity, | 61 void OnUpdatedCacheStats(uint64_t min_capacity, |
55 uint64_t max_capacity, | 62 uint64_t max_capacity, |
56 uint64_t capacity, | 63 uint64_t capacity, |
57 uint64_t live_size, | 64 uint64_t live_size, |
58 uint64_t dead_size); | 65 uint64_t dead_size); |
59 | 66 |
60 void OnAllowDatabase(int render_frame_id, | 67 void OnAllowDatabase(int render_frame_id, |
61 const GURL& origin_url, | 68 const GURL& origin_url, |
62 const GURL& top_origin_url, | 69 const GURL& top_origin_url, |
63 const base::string16& name, | 70 const base::string16& name, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // The Profile associated with our renderer process. This should only be | 132 // The Profile associated with our renderer process. This should only be |
126 // accessed on the UI thread! | 133 // accessed on the UI thread! |
127 Profile* profile_; | 134 Profile* profile_; |
128 // The Predictor for the associated Profile. It is stored so that it can be | 135 // The Predictor for the associated Profile. It is stored so that it can be |
129 // used on the IO thread. | 136 // used on the IO thread. |
130 chrome_browser_net::Predictor* predictor_; | 137 chrome_browser_net::Predictor* predictor_; |
131 | 138 |
132 // Used to look up permissions at database creation time. | 139 // Used to look up permissions at database creation time. |
133 scoped_refptr<content_settings::CookieSettings> cookie_settings_; | 140 scoped_refptr<content_settings::CookieSettings> cookie_settings_; |
134 | 141 |
142 mojo::BindingSet<network_hints::mojom::NetworkHints> bindings_; | |
143 | |
135 DISALLOW_COPY_AND_ASSIGN(ChromeRenderMessageFilter); | 144 DISALLOW_COPY_AND_ASSIGN(ChromeRenderMessageFilter); |
136 }; | 145 }; |
137 | 146 |
138 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ | 147 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ |
OLD | NEW |