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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_message_filter.h

Issue 2144533002: Convert network hints to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (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/common/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 {
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(
50 mojo::InterfaceRequest<network_hints::mojom::NetworkHints> request);
Sam McNally 2016/07/12 05:25:29 network_hints::mojom::NetworkHintsRequest
tibell 2016/07/12 07:14:24 Done.
51
46 private: 52 private:
47 friend class content::BrowserThread; 53 friend class content::BrowserThread;
48 friend class base::DeleteHelper<ChromeRenderMessageFilter>; 54 friend class base::DeleteHelper<ChromeRenderMessageFilter>;
49 55
50 ~ChromeRenderMessageFilter() override; 56 ~ChromeRenderMessageFilter() override;
51 57
52 void OnDnsPrefetch(const network_hints::LookupRequest& request); 58 // mojom::NetworkHints methods:
53 void OnPreconnect(const GURL& url, bool allow_credentials, int count); 59 void DNSPrefetch(const network_hints::LookupRequest& request) override;
60 void Preconnect(const GURL& url, bool allow_credentials, int count) override;
61
54 void OnUpdatedCacheStats(uint64_t min_capacity, 62 void OnUpdatedCacheStats(uint64_t min_capacity,
55 uint64_t max_capacity, 63 uint64_t max_capacity,
56 uint64_t capacity, 64 uint64_t capacity,
57 uint64_t live_size, 65 uint64_t live_size,
58 uint64_t dead_size); 66 uint64_t dead_size);
59 67
60 void OnAllowDatabase(int render_frame_id, 68 void OnAllowDatabase(int render_frame_id,
61 const GURL& origin_url, 69 const GURL& origin_url,
62 const GURL& top_origin_url, 70 const GURL& top_origin_url,
63 const base::string16& name, 71 const base::string16& name,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // The Profile associated with our renderer process. This should only be 133 // The Profile associated with our renderer process. This should only be
126 // accessed on the UI thread! 134 // accessed on the UI thread!
127 Profile* profile_; 135 Profile* profile_;
128 // The Predictor for the associated Profile. It is stored so that it can be 136 // The Predictor for the associated Profile. It is stored so that it can be
129 // used on the IO thread. 137 // used on the IO thread.
130 chrome_browser_net::Predictor* predictor_; 138 chrome_browser_net::Predictor* predictor_;
131 139
132 // Used to look up permissions at database creation time. 140 // Used to look up permissions at database creation time.
133 scoped_refptr<content_settings::CookieSettings> cookie_settings_; 141 scoped_refptr<content_settings::CookieSettings> cookie_settings_;
134 142
143 mojo::BindingSet<network_hints::mojom::NetworkHints> bindings_;
144
135 DISALLOW_COPY_AND_ASSIGN(ChromeRenderMessageFilter); 145 DISALLOW_COPY_AND_ASSIGN(ChromeRenderMessageFilter);
136 }; 146 };
137 147
138 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_ 148 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698