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/install_util.h" | 31 #include "chrome/installer/util/install_util.h" |
31 #include "chrome/installer/util/shell_util.h" | 32 #include "chrome/installer/util/shell_util.h" |
32 #include "chrome/installer/util/wmi.h" | 33 #include "chrome/installer/util/wmi.h" |
33 #include "content/public/common/result_codes.h" | 34 #include "content/public/common/result_codes.h" |
34 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
35 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
36 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
37 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
38 #include "ui/base/win/hwnd_util.h" | 39 #include "ui/base/win/hwnd_util.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 if (integrity_level == base::HIGH_INTEGRITY) | 195 if (integrity_level == base::HIGH_INTEGRITY) |
195 return false; | 196 return false; |
196 | 197 |
197 FilePath default_user_data_dir; | 198 FilePath default_user_data_dir; |
198 if (!chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) | 199 if (!chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) |
199 return false; | 200 return false; |
200 | 201 |
201 if (default_user_data_dir != user_data_dir) | 202 if (default_user_data_dir != user_data_dir) |
202 return false; | 203 return false; |
203 | 204 |
205 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUninstall)) | |
gab
2012/10/11 01:55:48
I feel this is a special case hiding a bigger prob
| |
206 return false; | |
207 | |
204 base::win::RegKey reg_key; | 208 base::win::RegKey reg_key; |
205 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, | 209 LONG key_result = reg_key.Create(HKEY_CURRENT_USER, |
206 chrome::kMetroRegistryPath, | 210 chrome::kMetroRegistryPath, |
207 KEY_READ); | 211 KEY_READ); |
208 if (key_result == ERROR_SUCCESS) { | 212 if (key_result == ERROR_SUCCESS) { |
209 DWORD reg_value = 0; | 213 DWORD reg_value = 0; |
210 reg_key.ReadValueDW(chrome::kLaunchModeValue, | 214 if (reg_key.ReadValueDW(chrome::kLaunchModeValue, ®_value) |
gab
2012/10/11 01:55:48
Isn't it simpler to have a single if for the logic
| |
211 ®_value); | 215 == ERROR_SUCCESS) { |
212 if (reg_value == 1) | 216 return reg_value == 1; |
213 return true; | 217 } |
214 } | 218 } |
215 return base::win::IsMachineATablet(); | 219 return base::win::IsMachineATablet(); |
216 } | 220 } |
217 | 221 |
218 } // namespace | 222 } // namespace |
219 | 223 |
220 // Microsoft's Softricity virtualization breaks the sandbox processes. | 224 // Microsoft's Softricity virtualization breaks the sandbox processes. |
221 // So, if we detect the Softricity DLL we use WMI Win32_Process.Create to | 225 // So, if we detect the Softricity DLL we use WMI Win32_Process.Create to |
222 // break out of the virtualization environment. | 226 // break out of the virtualization environment. |
223 // http://code.google.com/p/chromium/issues/detail?id=43650 | 227 // http://code.google.com/p/chromium/issues/detail?id=43650 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 switch (message) { | 523 switch (message) { |
520 case WM_COPYDATA: | 524 case WM_COPYDATA: |
521 return OnCopyData(reinterpret_cast<HWND>(wparam), | 525 return OnCopyData(reinterpret_cast<HWND>(wparam), |
522 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 526 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
523 default: | 527 default: |
524 break; | 528 break; |
525 } | 529 } |
526 | 530 |
527 return ::DefWindowProc(hwnd, message, wparam, lparam); | 531 return ::DefWindowProc(hwnd, message, wparam, lparam); |
528 } | 532 } |
OLD | NEW |