Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / cloud_print / service / win / chrome_launcher.cc
index 51f1253..5dd876d 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "base/base_switches.h"
 #include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
@@ -76,8 +76,10 @@ bool LaunchProcess(const CommandLine& cmdline,
   startup_info.wShowWindow = SW_SHOW;
 
   PROCESS_INFORMATION temp_process_info = {};
+  base::FilePath::StringType writable_cmdline_str(
+      cmdline.GetCommandLineString());
   if (!CreateProcess(NULL,
-      const_cast<wchar_t*>(cmdline.GetCommandLineString().c_str()), NULL, NULL,
+      &writable_cmdline_str[0], NULL, NULL,
       FALSE, 0, NULL, NULL, &startup_info, &temp_process_info)) {
     return false;
   }
@@ -222,7 +224,7 @@ void ChromeLauncher::Run() {
       DWORD thread_id = 0;
       LaunchProcess(cmd, &chrome_handle, &thread_id);
 
-      HANDLE handles[] = {stop_event_.handle(), chrome_handle};
+      HANDLE handles[] = { stop_event_.handle(), chrome_handle.Get() };
       DWORD wait_result = WAIT_TIMEOUT;
       while (wait_result == WAIT_TIMEOUT) {
         cloud_print::SetGoogleUpdateUsage(kGoogleUpdateId);
@@ -230,7 +232,7 @@ void ChromeLauncher::Run() {
                                                FALSE, kUsageUpdateTimeoutMs);
       }
       if (wait_result == WAIT_OBJECT_0) {
-        ShutdownChrome(chrome_handle, thread_id);
+        ShutdownChrome(chrome_handle.Get(), thread_id);
         break;
       } else if (wait_result == WAIT_OBJECT_0 + 1) {
         LOG(ERROR) << "Chrome process exited.";
@@ -300,7 +302,7 @@ std::string ChromeLauncher::CreateServiceStateFile(
   }
 
   for (;;) {
-    DWORD wait_result = ::WaitForSingleObject(chrome_handle, 500);
+    DWORD wait_result = ::WaitForSingleObject(chrome_handle.Get(), 500);
     std::string json = ReadAndUpdateServiceState(temp_user_data.path(),
                                                  proxy_id);
     if (wait_result == WAIT_OBJECT_0) {
@@ -313,7 +315,7 @@ std::string ChromeLauncher::CreateServiceStateFile(
     }
     if (!json.empty()) {
       // Close chrome because Service State is ready.
-      CloseChrome(chrome_handle, thread_id);
+      CloseChrome(chrome_handle.Get(), thread_id);
       return json;
     }
   }