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