[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 | |||||
avi | a9aa7a8 | 2015-12-25 03:06:31 | [diff] [blame^] | 10 | #include "base/macros.h" |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 11 | #include "base/memory/singleton.h" |
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 12 | #include "ipc/ipc_sender.h" |
13 | #include "ipc/message_filter.h" | ||||
14 | |||||
[email protected] | 13075767 | 2012-10-24 00:26:19 | [diff] [blame] | 15 | namespace content { |
16 | |||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 17 | // Dispatches messages used for font caching on Windows. This is needed because |
18 | // Windows can't load fonts into its kernel cache in sandboxed processes. So the | ||||
19 | // sandboxed process asks the browser process to do this for it. | ||||
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 20 | class FontCacheDispatcher : public IPC::MessageFilter, public IPC::Sender { |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 21 | public: |
22 | FontCacheDispatcher(); | ||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 23 | |
[email protected] | d84effeb | 2012-06-25 17:03:10 | [diff] [blame] | 24 | // IPC::Sender implementation: |
nick | 5120892 | 2015-04-24 21:38:37 | [diff] [blame] | 25 | bool Send(IPC::Message* message) override; |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 26 | |
27 | private: | ||||
thakis | efa363a | 2015-05-02 01:28:44 | [diff] [blame] | 28 | ~FontCacheDispatcher() override; |
29 | |||||
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 30 | // IPC::MessageFilter implementation: |
nick | 5120892 | 2015-04-24 21:38:37 | [diff] [blame] | 31 | void OnFilterAdded(IPC::Sender* sender) override; |
32 | bool OnMessageReceived(const IPC::Message& message) override; | ||||
33 | void OnChannelClosing() override; | ||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 34 | |
35 | // Message handlers. | ||||
36 | void OnPreCacheFont(const LOGFONT& font); | ||||
37 | void OnReleaseCachedFonts(); | ||||
38 | |||||
[email protected] | d1549b8 | 2014-06-13 06:07:14 | [diff] [blame] | 39 | IPC::Sender* sender_; |
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 40 | |
41 | DISALLOW_COPY_AND_ASSIGN(FontCacheDispatcher); | ||||
42 | }; | ||||
43 | |||||
[email protected] | 13075767 | 2012-10-24 00:26:19 | [diff] [blame] | 44 | } // namespace content |
45 | |||||
[email protected] | e35c9a8 | 2011-12-01 18:48:41 | [diff] [blame] | 46 | #endif // CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_ |