diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index bfac0b6fb7bc..26cb3985386f 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -393,12 +393,11 @@ void NativeWindow::AppendExtraCommandLineSwitches( base::DoubleToString(zoom_factor_)); #if defined(OS_WIN) - PWSTR explicit_app_id; - - if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(&explicit_app_id))) { - base::string16 appId = base::string16(explicit_app_id); - command_line->AppendSwitchNative(switches::kAppUserModelId, appId); - CoTaskMemFree(explicit_app_id); + // Append --app-user-model-id. + PWSTR current_app_id; + if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(¤t_app_id))) { + command_line->AppendSwitchNative(switches::kAppUserModelId, current_app_id); + CoTaskMemFree(current_app_id); } #endif diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 178be339008d..0311f8b540b0 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -91,17 +91,6 @@ void AtomRendererClient::WebKitInitialized() { blink::WebCustomElement::addEmbedderCustomElementName("webview"); blink::WebCustomElement::addEmbedderCustomElementName("browserplugin"); -#if defined(OS_WIN) - base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - base::string16 explicit_app_id = - command_line->GetSwitchValueNative(switches::kAppUserModelId); - - if (explicit_app_id.length() > 0) { - SetCurrentProcessExplicitAppUserModelID(explicit_app_id.c_str()); - } -#endif - node_bindings_->Initialize(); node_bindings_->PrepareMessageLoop(); @@ -117,6 +106,15 @@ void AtomRendererClient::WebKitInitialized() { void AtomRendererClient::RenderThreadStarted() { content::RenderThread::Get()->AddObserver(this); + +#if defined(OS_WIN) + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + base::string16 app_id = + command_line->GetSwitchValueNative(switches::kAppUserModelId); + if (!app_id.empty()) { + SetCurrentProcessExplicitAppUserModelID(app_id.c_str()); + } +#endif } void AtomRendererClient::RenderFrameCreated(