// Read icon before window is created.
options.Get(switches::kIcon, &icon_);
+ // The "preload" option must be absolute path.
+ if (options.Get(switches::kPreloadScript, &preload_script_) &&
+ !preload_script_.IsAbsolute()) {
+ LOG(ERROR) << "Path of \"preload\" script must be absolute.";
+ preload_script_.clear();
+ }
+
// Be compatible with old API of "node-integration" option.
std::string old_string_token;
if (options.Get(switches::kNodeIntegration, &old_string_token) &&
command_line->AppendSwitchASCII(switches::kNodeIntegration,
node_integration_ ? "true" : "false");
+ // Append --preload.
+ if (!preload_script_.empty())
+ command_line->AppendSwitchPath(switches::kPreloadScript, preload_script_);
+
// Append --zoom-factor.
if (zoom_factor_ != 1.0)
command_line->AppendSwitchASCII(switches::kZoomFactor,
// Web preferences.
mate::PersistentDictionary web_preferences_;
+ // The script to load before page's JavaScript starts to run.
+ base::FilePath preload_script_;
+
// Page's default zoom factor.
double zoom_factor_;
const char kGuestInstanceID[] = "guest-instance-id";
// Script that will be loaded by guest WebContents before other scripts.
-const char kPreloadScript[] = "preload-script";
+const char kPreloadScript[] = "preload";
// Web runtime features.
const char kExperimentalFeatures[] = "experimental-features";
require('web-frame').setName 'ATOM_SHELL_GUEST_WEB_VIEW'
else if arg.indexOf('--node-integration=') == 0
nodeIntegration = arg.substr arg.indexOf('=') + 1
- else if arg.indexOf('--preload-script=') == 0
+ else if arg.indexOf('--preload=') == 0
preloadScript = arg.substr arg.indexOf('=') + 1
if location.protocol is 'chrome-devtools:'