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

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: updated years in copyright 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
« no previous file with comments | « headless/lib/embed_data.py ('k') | headless/lib/util/embedded_file.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..653e7a11266cea7f0d3ff3e4b05dfbbd78ccf6b5 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,13 @@ void HeadlessContentMainDelegate::InitializeResourceBundle() {
ui::ResourceBundle::InitSharedInstanceWithLocale(
locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
+#ifdef HEADLESS_USE_EMBEDDED_RESOURCES
+ ResourceBundle::GetSharedInstance().AddDataPackFromBuffer(
+ base::StringPiece(
+ reinterpret_cast<const char*>(kHeadlessResourcePak.contents),
+ kHeadlessResourcePak.length),
+ ui::SCALE_FACTOR_NONE);
+#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 +196,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*
« no previous file with comments | « headless/lib/embed_data.py ('k') | headless/lib/util/embedded_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698