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 "win8/delegate_execute/chrome_util.h" | 5 #include "win8/delegate_execute/chrome_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <limits> | 12 #include <limits> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/md5.h" | 17 #include "base/md5.h" |
18 #include "base/process/kill.h" | 18 #include "base/process/kill.h" |
19 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
20 #include "base/process/process_handle.h" | 20 #include "base/process/process_handle.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
23 #include "base/win/registry.h" | 23 #include "base/win/registry.h" |
24 #include "base/win/scoped_comptr.h" | 24 #include "base/win/scoped_comptr.h" |
25 #include "base/win/scoped_handle.h" | 25 #include "base/win/scoped_handle.h" |
26 #include "base/win/win_util.h" | 26 #include "base/win/win_util.h" |
27 #include "chrome/installer/util/install_util.h" | |
27 #include "google_update/google_update_idl.h" | 28 #include "google_update/google_update_idl.h" |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 #if defined(GOOGLE_CHROME_BUILD) | 32 #if defined(GOOGLE_CHROME_BUILD) |
32 const wchar_t kAppUserModelId[] = L"Chrome"; | |
33 #else // GOOGLE_CHROME_BUILD | |
34 const wchar_t kAppUserModelId[] = L"Chromium"; | |
35 #endif // GOOGLE_CHROME_BUILD | |
36 | |
37 #if defined(GOOGLE_CHROME_BUILD) | |
38 | 33 |
39 // TODO(grt): These constants live in installer_util. Consider moving them | 34 // TODO(grt): These constants live in installer_util. Consider moving them |
grt (UTC plus 2)
2013/09/04 03:33:36
how many of these constants can be replaced with c
zturner
2013/09/05 01:35:29
I was only able to replace one constant, the one f
| |
40 // into common_constants to allow for reuse. | 35 // into common_constants to allow for reuse. |
41 const base::FilePath::CharType kNewChromeExe[] = | 36 const base::FilePath::CharType kNewChromeExe[] = |
42 FILE_PATH_LITERAL("new_chrome.exe"); | 37 FILE_PATH_LITERAL("new_chrome.exe"); |
43 const wchar_t kRenameCommandValue[] = L"cmd"; | 38 const wchar_t kRenameCommandValue[] = L"cmd"; |
44 const wchar_t kChromeAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 39 const wchar_t kChromeAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
45 const wchar_t kRegPathChromeClient[] = | 40 const wchar_t kRegPathChromeClient[] = |
46 L"Software\\Google\\Update\\Clients\\" | 41 L"Software\\Google\\Update\\Clients\\" |
47 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 42 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
48 const int kExitCodeRenameSuccessful = 23; | 43 const int kExitCodeRenameSuccessful = 23; |
49 | 44 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 AtlTrace("%hs. Failed to finalize update with exit code %d.\n", | 244 AtlTrace("%hs. Failed to finalize update with exit code %d.\n", |
250 __FUNCTION__, exit_code); | 245 __FUNCTION__, exit_code); |
251 } else { | 246 } else { |
252 AtlTrace("%hs. Finalized pending update.\n", __FUNCTION__); | 247 AtlTrace("%hs. Finalized pending update.\n", __FUNCTION__); |
253 } | 248 } |
254 } | 249 } |
255 #endif | 250 #endif |
256 } | 251 } |
257 | 252 |
258 // TODO(gab): This code also lives in shell_util. Refactor for reuse. | 253 // TODO(gab): This code also lives in shell_util. Refactor for reuse. |
259 string16 GetAppId(const base::FilePath& chrome_exe) { | 254 string16 GetAppId(const base::FilePath& chrome_exe) { |
gab
2013/09/03 21:05:19
All calls to this can be replaced by ShellUtil::Ge
zturner
2013/09/05 01:35:29
Done.
| |
260 string16 app_id(kAppUserModelId); | 255 string16 app_id(InstallUtil::GetAppUserModelId()); |
261 string16 suffix; | 256 string16 suffix; |
262 if (IsPerUserInstall(chrome_exe) && | 257 if (IsPerUserInstall(chrome_exe) && |
263 !GetUserSpecificRegistrySuffix(&suffix)) { | 258 !GetUserSpecificRegistrySuffix(&suffix)) { |
264 AtlTrace("%hs. GetUserSpecificRegistrySuffix failed.\n", | 259 AtlTrace("%hs. GetUserSpecificRegistrySuffix failed.\n", |
265 __FUNCTION__); | 260 __FUNCTION__); |
266 } | 261 } |
267 return app_id.append(suffix); | 262 return app_id.append(suffix); |
268 } | 263 } |
269 | 264 |
270 } // delegate_execute | 265 } // delegate_execute |
OLD | NEW |