OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chrome_process_finder_win.h" | 5 #include "chrome/browser/chrome_process_finder_win.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 base::Int64ToString( | 157 base::Int64ToString( |
158 base::CurrentProcessInfo::CreationTime().ToInternalValue())); | 158 base::CurrentProcessInfo::CreationTime().ToInternalValue())); |
159 | 159 |
160 if (fast_start) | 160 if (fast_start) |
161 command_line.AppendSwitch(switches::kFastStart); | 161 command_line.AppendSwitch(switches::kFastStart); |
162 | 162 |
163 // Send the command line to the remote chrome window. | 163 // Send the command line to the remote chrome window. |
164 // Format is "START\0<<<current directory>>>\0<<<commandline>>>". | 164 // Format is "START\0<<<current directory>>>\0<<<commandline>>>". |
165 std::wstring to_send(L"START\0", 6); // want the NULL in the string. | 165 std::wstring to_send(L"START\0", 6); // want the NULL in the string. |
166 base::FilePath cur_dir; | 166 base::FilePath cur_dir; |
167 if (!file_util::GetCurrentDirectory(&cur_dir)) | 167 if (!base::GetCurrentDirectory(&cur_dir)) |
168 return NOTIFY_FAILED; | 168 return NOTIFY_FAILED; |
169 to_send.append(cur_dir.value()); | 169 to_send.append(cur_dir.value()); |
170 to_send.append(L"\0", 1); // Null separator. | 170 to_send.append(L"\0", 1); // Null separator. |
171 to_send.append(command_line.GetCommandLineString()); | 171 to_send.append(command_line.GetCommandLineString()); |
172 to_send.append(L"\0", 1); // Null separator. | 172 to_send.append(L"\0", 1); // Null separator. |
173 | 173 |
174 // Allow the current running browser window to make itself the foreground | 174 // Allow the current running browser window to make itself the foreground |
175 // window (otherwise it will just flash in the taskbar). | 175 // window (otherwise it will just flash in the taskbar). |
176 ::AllowSetForegroundWindow(process_id); | 176 ::AllowSetForegroundWindow(process_id); |
177 | 177 |
(...skipping 14 matching lines...) Expand all Loading... |
192 | 192 |
193 // It is possible that the process owning this window may have died by now. | 193 // It is possible that the process owning this window may have died by now. |
194 if (!::IsWindow(remote_window)) | 194 if (!::IsWindow(remote_window)) |
195 return NOTIFY_FAILED; | 195 return NOTIFY_FAILED; |
196 | 196 |
197 // If the window couldn't be notified but still exists, assume it is hung. | 197 // If the window couldn't be notified but still exists, assume it is hung. |
198 return NOTIFY_WINDOW_HUNG; | 198 return NOTIFY_WINDOW_HUNG; |
199 } | 199 } |
200 | 200 |
201 } // namespace chrome | 201 } // namespace chrome |
OLD | NEW |