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

Unified Diff: headless/lib/headless_content_main_delegate.cc

Issue 1969313005: [headless] Embed pak file into binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resurrected Created 3 years, 10 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: headless/lib/headless_content_main_delegate.cc
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc
index 98c3076357f1ec4c7597bc6497ab85818c11831d..b1e3fb00f7308b018747b8659087443ab385cd14 100644
--- a/headless/lib/headless_content_main_delegate.cc
+++ b/headless/lib/headless_content_main_delegate.cc
@@ -20,6 +20,10 @@
#include "ui/gl/gl_switches.h"
#include "ui/ozone/public/ozone_switches.h"
+#ifdef HEADLESS_USE_EMBEDDED_RESOURCES
+#include "headless/embedded_resource_pak.h"
+#endif
+
namespace headless {
namespace {
// Keep in sync with content/common/content_constants_internal.h.
@@ -177,6 +181,11 @@ void HeadlessContentMainDelegate::InitializeResourceBundle() {
ui::ResourceBundle::InitSharedInstanceWithLocale(
locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
+#ifdef HEADLESS_USE_EMBEDDED_RESOURCES
+ ResourceBundle::GetSharedInstance().AddDataPackFromBuffer(
+ reinterpret_cast<const char*>(kHeadlessResourcePak.contents),
+ kHeadlessResourcePak.length);
+#else
// Try loading the headless library pak file first. If it doesn't exist (i.e.,
// when we're running with the --headless switch), fall back to the browser's
// resource pak.
@@ -185,6 +194,7 @@ void HeadlessContentMainDelegate::InitializeResourceBundle() {
pak_file = dir_module.Append(FILE_PATH_LITERAL("resources.pak"));
ResourceBundle::GetSharedInstance().AddDataPackFromPath(
pak_file, ui::SCALE_FACTOR_NONE);
+#endif
}
content::ContentBrowserClient*

Powered by Google App Engine
This is Rietveld 408576698