Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h

Issue 2153343002: Implement support for loading font files from outside system directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some more comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
diff --git a/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h b/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
index 7539ff16f6b4a9a22b48b0a4a944747efa672f99..0939c9f20185d66096a8e5a07d3f3a2f21e4bdde 100644
--- a/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
+++ b/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
@@ -18,6 +18,7 @@
#include "content/common/content_export.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
+#include "ipc/ipc_platform_file.h"
struct DWriteFontStyle;
struct MapCharactersResult;
@@ -37,6 +38,8 @@ class CONTENT_EXPORT DWriteFontProxyMessageFilter
void OverrideThreadForMessage(const IPC::Message& message,
content::BrowserThread::ID* thread) override;
+ void SetWindowsFontsPathForTesting(base::string16 path);
+
protected:
~DWriteFontProxyMessageFilter() override;
@@ -46,7 +49,8 @@ class CONTENT_EXPORT DWriteFontProxyMessageFilter
UINT32 family_index,
std::vector<std::pair<base::string16, base::string16>>* family_names);
void OnGetFontFiles(UINT32 family_index,
- std::vector<base::string16>* file_paths);
+ std::vector<base::string16>* file_paths,
+ std::vector<IPC::PlatformFileForTransit>* file_handles);
void OnMapCharacters(const base::string16& text,
const DWriteFontStyle& font_style,
const base::string16& locale_name,
@@ -57,19 +61,25 @@ class CONTENT_EXPORT DWriteFontProxyMessageFilter
void InitializeDirectWrite();
private:
- bool AddFilesForFont(std::set<base::string16>* path_set, IDWriteFont* font);
+ bool AddFilesForFont(std::set<base::string16>* path_set,
+ std::set<base::string16>* custom_font_path_set,
+ IDWriteFont* font);
bool AddLocalFile(std::set<base::string16>* path_set,
+ std::set<base::string16>* custom_font_path_set,
IDWriteLocalFontFileLoader* local_loader,
IDWriteFontFile* font_file);
bool IsLastResortFallbackFont(uint32_t font_index);
private:
+ enum CustomFontFileLoadingMode { ENABLE, DISABLE, FORCE };
+
bool direct_write_initialized_ = false;
Microsoft::WRL::ComPtr<IDWriteFontCollection> collection_;
Microsoft::WRL::ComPtr<IDWriteFactory2> factory2_;
Microsoft::WRL::ComPtr<IDWriteFontFallback> font_fallback_;
base::string16 windows_fonts_path_;
+ CustomFontFileLoadingMode custom_font_file_loading_mode_;
// Temp code to help track down crbug.com/561873
std::vector<uint32_t> last_resort_fonts_;

Powered by Google App Engine
This is Rietveld 408576698