Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 67229: Use different names for Chrome/Chromium for Chrome HTML prog id. If we (Closed)
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/setup/setup.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include <windows.h> 10 #include <windows.h>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // This method returns a list of all the registry entries that are needed 46 // This method returns a list of all the registry entries that are needed
47 // to register Chrome. 47 // to register Chrome.
48 static std::list<RegistryEntry*> GetAllEntries( 48 static std::list<RegistryEntry*> GetAllEntries(
49 const std::wstring& chrome_exe) { 49 const std::wstring& chrome_exe) {
50 std::list<RegistryEntry*> entries; 50 std::list<RegistryEntry*> entries;
51 std::wstring icon_path(chrome_exe); 51 std::wstring icon_path(chrome_exe);
52 ShellUtil::GetChromeIcon(icon_path); 52 ShellUtil::GetChromeIcon(icon_path);
53 std::wstring quoted_exe_path = L"\"" + chrome_exe + L"\""; 53 std::wstring quoted_exe_path = L"\"" + chrome_exe + L"\"";
54 std::wstring open_cmd = ShellUtil::GetChromeShellOpenCmd(chrome_exe); 54 std::wstring open_cmd = ShellUtil::GetChromeShellOpenCmd(chrome_exe);
55 55
56 entries.push_front(new RegistryEntry(L"Software\\Classes\\ChromeHTML", 56 std::wstring chrome_html_prog_id(ShellUtil::kRegClasses);
57 file_util::AppendToPath(&chrome_html_prog_id, ShellUtil::kChromeHTMLProgId);
58 entries.push_front(new RegistryEntry(chrome_html_prog_id,
57 ShellUtil::kChromeHTMLProgIdDesc)); 59 ShellUtil::kChromeHTMLProgIdDesc));
58 entries.push_front(new RegistryEntry( 60 entries.push_front(new RegistryEntry(
59 L"Software\\Classes\\ChromeHTML\\DefaultIcon", icon_path)); 61 chrome_html_prog_id + ShellUtil::kRegDefaultIcon, icon_path));
60 entries.push_front(new RegistryEntry( 62 entries.push_front(new RegistryEntry(
61 L"Software\\Classes\\ChromeHTML\\shell\\open\\command", open_cmd)); 63 chrome_html_prog_id + ShellUtil::kRegShellOpen, open_cmd));
62 64
63 std::wstring exe_name = file_util::GetFilenameFromPath(chrome_exe); 65 std::wstring exe_name = file_util::GetFilenameFromPath(chrome_exe);
64 std::wstring app_key = L"Software\\Classes\\Applications\\" + exe_name + 66 std::wstring app_key = L"Software\\Classes\\Applications\\" + exe_name +
65 L"\\shell\\open\\command"; 67 L"\\shell\\open\\command";
66 entries.push_front(new RegistryEntry(app_key, open_cmd)); 68 entries.push_front(new RegistryEntry(app_key, open_cmd));
67 for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) { 69 for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) {
68 std::wstring open_with_key(L"Software\\Classes\\"); 70 std::wstring open_with_key(L"Software\\Classes\\");
69 open_with_key.append(ShellUtil::kFileAssociations[i]); 71 open_with_key.append(ShellUtil::kFileAssociations[i]);
70 open_with_key.append(L"\\OpenWithList\\" + exe_name); 72 open_with_key.append(L"\\OpenWithList\\" + exe_name);
71 entries.push_front(new RegistryEntry(open_with_key, std::wstring())); 73 entries.push_front(new RegistryEntry(open_with_key, std::wstring()));
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (ret_val == ShellUtil::SUCCESS) 352 if (ret_val == ShellUtil::SUCCESS)
351 return ShellUtil::SUCCESS; 353 return ShellUtil::SUCCESS;
352 } 354 }
353 } 355 }
354 return ShellUtil::FAILURE; 356 return ShellUtil::FAILURE;
355 } 357 }
356 358
357 // Remove unnecessary "URL Protocol" entry from shell registration. This value 359 // Remove unnecessary "URL Protocol" entry from shell registration. This value
358 // was written by older installers so ignoring error conditions. 360 // was written by older installers so ignoring error conditions.
359 void RemoveUrlProtocol(HKEY root) { 361 void RemoveUrlProtocol(HKEY root) {
360 RegKey key(root, L"Software\\Classes\\ChromeHTML", KEY_ALL_ACCESS); 362 std::wstring chrome_html_prog_id(ShellUtil::kRegClasses);
363 file_util::AppendToPath(&chrome_html_prog_id, ShellUtil::kChromeHTMLProgId);
364 RegKey key(root, chrome_html_prog_id.c_str(), KEY_ALL_ACCESS);
361 key.DeleteValue(ShellUtil::kRegUrlProtocol); 365 key.DeleteValue(ShellUtil::kRegUrlProtocol);
362 } 366 }
363 367
364 } // namespace 368 } // namespace
365 369
366 370
367 const wchar_t* ShellUtil::kRegDefaultIcon = L"\\DefaultIcon"; 371 const wchar_t* ShellUtil::kRegDefaultIcon = L"\\DefaultIcon";
368 const wchar_t* ShellUtil::kRegShellPath = L"\\shell"; 372 const wchar_t* ShellUtil::kRegShellPath = L"\\shell";
369 const wchar_t* ShellUtil::kRegShellOpen = L"\\shell\\open\\command"; 373 const wchar_t* ShellUtil::kRegShellOpen = L"\\shell\\open\\command";
370 const wchar_t* ShellUtil::kRegStartMenuInternet = 374 const wchar_t* ShellUtil::kRegStartMenuInternet =
371 L"Software\\Clients\\StartMenuInternet"; 375 L"Software\\Clients\\StartMenuInternet";
372 const wchar_t* ShellUtil::kRegClasses = L"Software\\Classes"; 376 const wchar_t* ShellUtil::kRegClasses = L"Software\\Classes";
373 const wchar_t* ShellUtil::kRegRegisteredApplications = 377 const wchar_t* ShellUtil::kRegRegisteredApplications =
374 L"Software\\RegisteredApplications"; 378 L"Software\\RegisteredApplications";
375 const wchar_t* ShellUtil::kRegVistaUrlPrefs = 379 const wchar_t* ShellUtil::kRegVistaUrlPrefs =
376 L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\" 380 L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\"
377 L"http\\UserChoice"; 381 L"http\\UserChoice";
378 const wchar_t* ShellUtil::kAppPathsRegistryKey = 382 const wchar_t* ShellUtil::kAppPathsRegistryKey =
379 L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"; 383 L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths";
380 const wchar_t* ShellUtil::kAppPathsRegistryPathName = L"Path"; 384 const wchar_t* ShellUtil::kAppPathsRegistryPathName = L"Path";
381 385
386 #if defined(GOOGLE_CHROME_BUILD)
382 const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromeHTML"; 387 const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromeHTML";
383 const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chrome HTML"; 388 const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chrome HTML";
389 #else
390 const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromiumHTML";
391 const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chromium HTML";
392 #endif
393
384 const wchar_t* ShellUtil::kFileAssociations[] = {L".htm", L".html", L".shtml", 394 const wchar_t* ShellUtil::kFileAssociations[] = {L".htm", L".html", L".shtml",
385 L".xht", L".xhtml", NULL}; 395 L".xht", L".xhtml", NULL};
386 const wchar_t* ShellUtil::kProtocolAssociations[] = {L"ftp", L"http", L"https", 396 const wchar_t* ShellUtil::kProtocolAssociations[] = {L"ftp", L"http", L"https",
387 NULL}; 397 NULL};
388 const wchar_t* ShellUtil::kRegUrlProtocol = L"URL Protocol"; 398 const wchar_t* ShellUtil::kRegUrlProtocol = L"URL Protocol";
389 399
390 const wchar_t* ShellUtil::kChromeExtProgId = L"ChromeExt"; 400 const wchar_t* ShellUtil::kChromeExtProgId = L"ChromeExt";
391 const wchar_t* ShellUtil::kChromeExtProgIdDesc = L"Chrome Extension Installer"; 401 const wchar_t* ShellUtil::kChromeExtProgIdDesc = L"Chrome Extension Installer";
392 402
393 ShellUtil::RegisterStatus ShellUtil::AddChromeToSetAccessDefaults( 403 ShellUtil::RegisterStatus ShellUtil::AddChromeToSetAccessDefaults(
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } else { 675 } else {
666 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target 676 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target
667 shortcut.c_str(), // shortcut 677 shortcut.c_str(), // shortcut
668 chrome_path.c_str(), // working dir 678 chrome_path.c_str(), // working dir
669 NULL, // arguments 679 NULL, // arguments
670 description.c_str(), // description 680 description.c_str(), // description
671 chrome_exe.c_str(), // icon file 681 chrome_exe.c_str(), // icon file
672 0); // icon index 682 0); // icon index
673 } 683 }
674 } 684 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698