OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implementation of the CommandExecuteImpl class which implements the | 4 // Implementation of the CommandExecuteImpl class which implements the |
5 // IExecuteCommand and related interfaces for handling ShellExecute based | 5 // IExecuteCommand and related interfaces for handling ShellExecute based |
6 // launches of the Chrome browser. | 6 // launches of the Chrome browser. |
7 | 7 |
8 #include "win8/delegate_execute/command_execute_impl.h" | 8 #include "win8/delegate_execute/command_execute_impl.h" |
9 | 9 |
10 #include <shlguid.h> | 10 #include <shlguid.h> |
11 | 11 |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/win/message_window.h" |
15 #include "base/win/registry.h" | 16 #include "base/win/registry.h" |
16 #include "base/win/scoped_co_mem.h" | 17 #include "base/win/scoped_co_mem.h" |
17 #include "base/win/scoped_handle.h" | 18 #include "base/win/scoped_handle.h" |
18 #include "base/win/scoped_process_information.h" | 19 #include "base/win/scoped_process_information.h" |
19 #include "base/win/win_util.h" | 20 #include "base/win/win_util.h" |
20 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/installer/util/util_constants.h" | 24 #include "chrome/installer/util/util_constants.h" |
24 #include "ui/base/clipboard/clipboard_util_win.h" | 25 #include "ui/base/clipboard/clipboard_util_win.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 247 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
247 AtlTrace("Failed to get chrome's data dir path, E_FAIL\n"); | 248 AtlTrace("Failed to get chrome's data dir path, E_FAIL\n"); |
248 return E_FAIL; | 249 return E_FAIL; |
249 } | 250 } |
250 | 251 |
251 bool decision_made = false; | 252 bool decision_made = false; |
252 | 253 |
253 // New Aura/Ash world we don't want to go throgh FindWindow path | 254 // New Aura/Ash world we don't want to go throgh FindWindow path |
254 // and instead take decision based on launch mode. | 255 // and instead take decision based on launch mode. |
255 #if !defined(USE_AURA) | 256 #if !defined(USE_AURA) |
256 HWND chrome_window = ::FindWindowEx(HWND_MESSAGE, NULL, | 257 HWND chrome_window = base::win::MessageWindow::FindWindow( |
257 chrome::kMessageWindowClass, | 258 user_data_dir.value()); |
258 user_data_dir.value().c_str()); | |
259 if (chrome_window) { | 259 if (chrome_window) { |
260 AtlTrace("Found chrome window %p\n", chrome_window); | 260 AtlTrace("Found chrome window %p\n", chrome_window); |
261 // The failure cases below are deemed to happen due to the inherently racy | 261 // The failure cases below are deemed to happen due to the inherently racy |
262 // procedure of going from chrome's window to process handle during which | 262 // procedure of going from chrome's window to process handle during which |
263 // chrome might have exited. Failing here would probably just cause the | 263 // chrome might have exited. Failing here would probably just cause the |
264 // user to retry at which point we would do the right thing. | 264 // user to retry at which point we would do the right thing. |
265 DWORD chrome_pid = 0; | 265 DWORD chrome_pid = 0; |
266 ::GetWindowThreadProcessId(chrome_window, &chrome_pid); | 266 ::GetWindowThreadProcessId(chrome_window, &chrome_pid); |
267 if (!chrome_pid) { | 267 if (!chrome_pid) { |
268 AtlTrace("Failed to get chrome's PID, E_FAIL\n"); | 268 AtlTrace("Failed to get chrome's PID, E_FAIL\n"); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 AtlTrace("Invalid registry launch mode value %u\n", reg_value); | 576 AtlTrace("Invalid registry launch mode value %u\n", reg_value); |
577 launch_mode = ECHUIM_DESKTOP; | 577 launch_mode = ECHUIM_DESKTOP; |
578 } else { | 578 } else { |
579 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); | 579 launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); |
580 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); | 580 AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); |
581 } | 581 } |
582 | 582 |
583 launch_mode_determined = true; | 583 launch_mode_determined = true; |
584 return launch_mode; | 584 return launch_mode; |
585 } | 585 } |
OLD | NEW |