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