]> khamidou — GitHub mirrors - electron.git/commitdiff
Cleanup code
authorCheng Zhao <zcbenz@gmail.com>
Mon, 13 Jul 2015 19:23:19 +0000 (03:23 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 13 Jul 2015 19:23:19 +0000 (03:23 +0800)
atom/browser/native_window.cc
atom/renderer/atom_renderer_client.cc

index bfac0b6fb7bceab43023a71d02d4d006090e41c5..26cb3985386f2b9d644097f619ec5a8c1377c040 100644 (file)
@@ -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(&current_app_id))) {
+    command_line->AppendSwitchNative(switches::kAppUserModelId, current_app_id);
+    CoTaskMemFree(current_app_id);
   }
 #endif
 
index 178be339008d8fbe177a11d2b6495951d8e9036d..0311f8b540b0cec250bc0fa04dcda64b73f48c91 100644 (file)
@@ -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(