[email protected] | f786717 | 2012-07-11 07:04:07 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ | ||||
6 | #define CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ | ||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 7 | |
8 | #include <windows.h> | ||||
9 | |||||
10 | #include "base/basictypes.h" | ||||
11 | #include "base/memory/singleton.h" | ||||
12 | #include "ipc/ipc_channel_proxy.h" | ||||
13 | |||||
[email protected] | 13075767 | 2012-10-24 00:26:19 | [diff] [blame^] | 14 | namespace content { |
15 | |||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 16 | // 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 | ||||
18 | // sandboxed process asks the browser process to do this for it. | ||||
19 | class FontCacheDispatcher : public IPC::ChannelProxy::MessageFilter, | ||||
[email protected] | d84effeb | 2012-06-25 17:03:10 | [diff] [blame] | 20 | public IPC::Sender { |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 21 | public: |
22 | FontCacheDispatcher(); | ||||
23 | virtual ~FontCacheDispatcher(); | ||||
24 | |||||
[email protected] | d84effeb | 2012-06-25 17:03:10 | [diff] [blame] | 25 | // IPC::Sender implementation: |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 26 | virtual bool Send(IPC::Message* message) OVERRIDE; |
27 | |||||
28 | private: | ||||
29 | // IPC::ChannelProxy::MessageFilter implementation: | ||||
30 | virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; | ||||
31 | virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | ||||
32 | virtual void OnChannelClosing() OVERRIDE; | ||||
33 | |||||
34 | // Message handlers. | ||||
35 | void OnPreCacheFont(const LOGFONT& font); | ||||
36 | void OnReleaseCachedFonts(); | ||||
37 | |||||
38 | IPC::Channel* channel_; | ||||
39 | |||||
40 | DISALLOW_COPY_AND_ASSIGN(FontCacheDispatcher); | ||||
41 | }; | ||||
42 | |||||
[email protected] | 13075767 | 2012-10-24 00:26:19 | [diff] [blame^] | 43 | } // namespace content |
44 | |||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 45 | #endif // CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ |