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 CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ | 5 #ifndef CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ |
6 #define CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ | 6 #define CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "ipc/ipc_channel_proxy.h" | 12 #include "ipc/ipc_sender.h" |
| 13 #include "ipc/message_filter.h" |
| 14 |
| 15 namespace IPC { |
| 16 class Channel; |
| 17 } |
13 | 18 |
14 namespace content { | 19 namespace content { |
15 | 20 |
16 // Dispatches messages used for font caching on Windows. This is needed because | 21 // Dispatches messages used for font caching on Windows. This is needed because |
17 // Windows can't load fonts into its kernel cache in sandboxed processes. So the | 22 // Windows can't load fonts into its kernel cache in sandboxed processes. So the |
18 // sandboxed process asks the browser process to do this for it. | 23 // sandboxed process asks the browser process to do this for it. |
19 class FontCacheDispatcher : public IPC::ChannelProxy::MessageFilter, | 24 class FontCacheDispatcher : public IPC::MessageFilter, public IPC::Sender { |
20 public IPC::Sender { | |
21 public: | 25 public: |
22 FontCacheDispatcher(); | 26 FontCacheDispatcher(); |
23 virtual ~FontCacheDispatcher(); | 27 virtual ~FontCacheDispatcher(); |
24 | 28 |
25 // IPC::Sender implementation: | 29 // IPC::Sender implementation: |
26 virtual bool Send(IPC::Message* message) OVERRIDE; | 30 virtual bool Send(IPC::Message* message) OVERRIDE; |
27 | 31 |
28 private: | 32 private: |
29 // IPC::ChannelProxy::MessageFilter implementation: | 33 // IPC::MessageFilter implementation: |
30 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; | 34 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; |
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
32 virtual void OnChannelClosing() OVERRIDE; | 36 virtual void OnChannelClosing() OVERRIDE; |
33 | 37 |
34 // Message handlers. | 38 // Message handlers. |
35 void OnPreCacheFont(const LOGFONT& font); | 39 void OnPreCacheFont(const LOGFONT& font); |
36 void OnReleaseCachedFonts(); | 40 void OnReleaseCachedFonts(); |
37 | 41 |
38 IPC::Channel* channel_; | 42 IPC::Channel* channel_; |
39 | 43 |
40 DISALLOW_COPY_AND_ASSIGN(FontCacheDispatcher); | 44 DISALLOW_COPY_AND_ASSIGN(FontCacheDispatcher); |
41 }; | 45 }; |
42 | 46 |
43 } // namespace content | 47 } // namespace content |
44 | 48 |
45 #endif // CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ | 49 #endif // CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ |
OLD | NEW |