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 | 4 |
5 #include "chrome/browser/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/win/metro.h" | 17 #include "base/win/metro.h" |
18 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
19 #include "base/win/scoped_com_initializer.h" | 19 #include "base/win/scoped_com_initializer.h" |
20 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
21 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
22 #include "base/win/win_util.h" | 22 #include "base/win/win_util.h" |
23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
24 #include "base/win/wrapped_window_proc.h" | 24 #include "base/win/wrapped_window_proc.h" |
25 #include "chrome/browser/ui/simple_message_box.h" | 25 #include "chrome/browser/ui/simple_message_box.h" |
26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/common/chrome_paths_internal.h" | 28 #include "chrome/common/chrome_paths_internal.h" |
| 29 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/installer/util/browser_distribution.h" | 30 #include "chrome/installer/util/browser_distribution.h" |
30 #include "chrome/installer/util/shell_util.h" | 31 #include "chrome/installer/util/shell_util.h" |
31 #include "chrome/installer/util/wmi.h" | 32 #include "chrome/installer/util/wmi.h" |
32 #include "content/public/common/result_codes.h" | 33 #include "content/public/common/result_codes.h" |
33 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
35 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
37 #include "ui/base/win/hwnd_util.h" | 38 #include "ui/base/win/hwnd_util.h" |
38 | 39 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (integrity_level == base::HIGH_INTEGRITY) | 193 if (integrity_level == base::HIGH_INTEGRITY) |
193 return false; | 194 return false; |
194 | 195 |
195 FilePath default_user_data_dir; | 196 FilePath default_user_data_dir; |
196 if (!chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) | 197 if (!chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) |
197 return false; | 198 return false; |
198 | 199 |
199 if (default_user_data_dir != user_data_dir) | 200 if (default_user_data_dir != user_data_dir) |
200 return false; | 201 return false; |
201 | 202 |
| 203 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUninstall)) |
| 204 return false; |
| 205 |
202 base::win::RegKey reg_key; | 206 base::win::RegKey reg_key; |
203 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, | 207 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, |
204 chrome::kMetroRegistryPath, | 208 chrome::kMetroRegistryPath, |
205 KEY_READ); | 209 KEY_READ); |
206 if (key_result == ERROR_SUCCESS) { | 210 if (key_result == ERROR_SUCCESS) { |
207 DWORD reg_value = 0; | 211 DWORD reg_value = 0; |
208 reg_key.ReadValueDW(chrome::kLaunchModeValue, | 212 if (reg_key.ReadValueDW(chrome::kLaunchModeValue, ®_value) |
209 ®_value); | 213 == ERROR_SUCCESS) { |
210 if (reg_value == 1) | 214 return reg_value == 1; |
211 return true; | 215 } |
212 } | 216 } |
213 return base::win::IsMachineATablet(); | 217 return base::win::IsMachineATablet(); |
214 } | 218 } |
215 | 219 |
216 } // namespace | 220 } // namespace |
217 | 221 |
218 // Microsoft's Softricity virtualization breaks the sandbox processes. | 222 // Microsoft's Softricity virtualization breaks the sandbox processes. |
219 // So, if we detect the Softricity DLL we use WMI Win32_Process.Create to | 223 // So, if we detect the Softricity DLL we use WMI Win32_Process.Create to |
220 // break out of the virtualization environment. | 224 // break out of the virtualization environment. |
221 // http://code.google.com/p/chromium/issues/detail?id=43650 | 225 // http://code.google.com/p/chromium/issues/detail?id=43650 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 switch (message) { | 521 switch (message) { |
518 case WM_COPYDATA: | 522 case WM_COPYDATA: |
519 return OnCopyData(reinterpret_cast<HWND>(wparam), | 523 return OnCopyData(reinterpret_cast<HWND>(wparam), |
520 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 524 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
521 default: | 525 default: |
522 break; | 526 break; |
523 } | 527 } |
524 | 528 |
525 return ::DefWindowProc(hwnd, message, wparam, lparam); | 529 return ::DefWindowProc(hwnd, message, wparam, lparam); |
526 } | 530 } |
OLD | NEW |