| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ |
| 6 #define CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/browser_message_filter.h" | 8 #include "content/public/browser/browser_message_filter.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 class URLRequestContextGetter; | 11 class URLRequestContextGetter; |
| 12 } | 12 } |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 // This class filters out incoming Chrome-specific benchmarking IPC messages | 16 // This class filters out incoming Chrome-specific benchmarking IPC messages |
| 17 // for the renderer process on the IPC thread. | 17 // for the renderer process on the IPC thread. |
| 18 class ChromeNetBenchmarkingMessageFilter | 18 class ChromeNetBenchmarkingMessageFilter |
| 19 : public content::BrowserMessageFilter { | 19 : public content::BrowserMessageFilter { |
| 20 public: | 20 public: |
| 21 ChromeNetBenchmarkingMessageFilter( | 21 ChromeNetBenchmarkingMessageFilter( |
| 22 Profile* profile, | 22 Profile* profile, |
| 23 net::URLRequestContextGetter* request_context); | 23 net::URLRequestContextGetter* request_context); |
| 24 | 24 |
| 25 // content::BrowserMessageFilter methods: | 25 // content::BrowserMessageFilter methods: |
| 26 virtual bool OnMessageReceived(const IPC::Message& message, | 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 27 bool* message_was_ok) OVERRIDE; | |
| 28 | 27 |
| 29 private: | 28 private: |
| 30 virtual ~ChromeNetBenchmarkingMessageFilter(); | 29 virtual ~ChromeNetBenchmarkingMessageFilter(); |
| 31 | 30 |
| 32 // Message handlers. | 31 // Message handlers. |
| 33 void OnCloseCurrentConnections(); | 32 void OnCloseCurrentConnections(); |
| 34 void OnClearCache(IPC::Message* reply_msg); | 33 void OnClearCache(IPC::Message* reply_msg); |
| 35 void OnClearHostResolverCache(int* result); | 34 void OnClearHostResolverCache(int* result); |
| 36 void OnSetCacheMode(bool enabled); | 35 void OnSetCacheMode(bool enabled); |
| 37 void OnClearPredictorCache(int* result); | 36 void OnClearPredictorCache(int* result); |
| 38 | 37 |
| 39 // Returns true if benchmarking is enabled for chrome. | 38 // Returns true if benchmarking is enabled for chrome. |
| 40 bool CheckBenchmarkingEnabled() const; | 39 bool CheckBenchmarkingEnabled() const; |
| 41 | 40 |
| 42 // The Profile associated with our renderer process. This should only be | 41 // The Profile associated with our renderer process. This should only be |
| 43 // accessed on the UI thread! | 42 // accessed on the UI thread! |
| 44 Profile* profile_; | 43 Profile* profile_; |
| 45 scoped_refptr<net::URLRequestContextGetter> request_context_; | 44 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 46 | 45 |
| 47 DISALLOW_COPY_AND_ASSIGN(ChromeNetBenchmarkingMessageFilter); | 46 DISALLOW_COPY_AND_ASSIGN(ChromeNetBenchmarkingMessageFilter); |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 #endif // CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ | 49 #endif // CHROME_BROWSER_CHROME_NET_BENCHMARKING_MESSAGE_FILTER_H_ |
| 51 | 50 |
| OLD | NEW |