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

Unified Diff: headless/lib/headless_content_main_delegate.cc

Issue 2576413002: chrome: Include headless resources (Closed)
Patch Set: Linux-only for now Created 4 years 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/BUILD.gn ('k') | no next file » | 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 44ee7094566e4a67bf77d093a94513c89a393364..80eea89be0138a65c64f063d5d898b521482b198 100644
--- a/headless/lib/headless_content_main_delegate.cc
+++ b/headless/lib/headless_content_main_delegate.cc
@@ -5,6 +5,7 @@
#include "headless/lib/headless_content_main_delegate.h"
#include "base/command_line.h"
+#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/trace_event/trace_event.h"
@@ -109,10 +110,16 @@ HeadlessContentMainDelegate* HeadlessContentMainDelegate::GetInstance() {
// static
void HeadlessContentMainDelegate::InitializeResourceBundle() {
+ base::FilePath dir_module;
base::FilePath pak_file;
- bool result = PathService::Get(base::DIR_MODULE, &pak_file);
+ bool result = PathService::Get(base::DIR_MODULE, &dir_module);
DCHECK(result);
- pak_file = pak_file.Append(FILE_PATH_LITERAL("headless_lib.pak"));
+ // 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.
+ pak_file = dir_module.Append(FILE_PATH_LITERAL("headless_lib.pak"));
+ if (!base::PathExists(pak_file))
+ pak_file = dir_module.Append(FILE_PATH_LITERAL("resources.pak"));
ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
altimin 2016/12/15 18:43:23 AFAIK, InitSharedInstanceWithPakPath is debug-only
Sami 2016/12/15 18:44:30 That's right. Do you mind if I do that as a follow
}
« no previous file with comments | « headless/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698