blob: dbdcb4f462bbcd5a120324683db7eed70bbb47a0 [file] [log] [blame]
[email protected]f7867172012-07-11 07:04:071// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]e35c9a82011-12-01 18:48:412// 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]e35c9a82011-12-01 18:48:417
8#include <windows.h>
9
avia9aa7a82015-12-25 03:06:3110#include "base/macros.h"
[email protected]e35c9a82011-12-01 18:48:4111#include "base/memory/singleton.h"
[email protected]74122042014-04-25 00:07:3012#include "ipc/ipc_sender.h"
13#include "ipc/message_filter.h"
14
[email protected]130757672012-10-24 00:26:1915namespace content {
16
[email protected]e35c9a82011-12-01 18:48:4117// 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]74122042014-04-25 00:07:3020class FontCacheDispatcher : public IPC::MessageFilter, public IPC::Sender {
[email protected]e35c9a82011-12-01 18:48:4121 public:
22 FontCacheDispatcher();
[email protected]e35c9a82011-12-01 18:48:4123
[email protected]d84effeb2012-06-25 17:03:1024 // IPC::Sender implementation:
nick51208922015-04-24 21:38:3725 bool Send(IPC::Message* message) override;
[email protected]e35c9a82011-12-01 18:48:4126
27 private:
thakisefa363a2015-05-02 01:28:4428 ~FontCacheDispatcher() override;
29
[email protected]74122042014-04-25 00:07:3030 // IPC::MessageFilter implementation:
nick51208922015-04-24 21:38:3731 void OnFilterAdded(IPC::Sender* sender) override;
32 bool OnMessageReceived(const IPC::Message& message) override;
33 void OnChannelClosing() override;
[email protected]e35c9a82011-12-01 18:48:4134
35 // Message handlers.
36 void OnPreCacheFont(const LOGFONT& font);
37 void OnReleaseCachedFonts();
38
[email protected]d1549b82014-06-13 06:07:1439 IPC::Sender* sender_;
[email protected]e35c9a82011-12-01 18:48:4140
41 DISALLOW_COPY_AND_ASSIGN(FontCacheDispatcher);
42};
43
[email protected]130757672012-10-24 00:26:1944} // namespace content
45
[email protected]e35c9a82011-12-01 18:48:4146#endif // CONTENT_COMMON_FONT_CACHE_DISPATCHER_WIN_H_