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
|
} |