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 // 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 "chrome/installer/util/shell_util.h" | 10 #include "chrome/installer/util/shell_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "base/win/windows_version.h" | 42 #include "base/win/windows_version.h" |
43 #include "chrome/common/chrome_constants.h" | 43 #include "chrome/common/chrome_constants.h" |
44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/installer/util/browser_distribution.h" | 45 #include "chrome/installer/util/browser_distribution.h" |
46 #include "chrome/installer/util/install_util.h" | 46 #include "chrome/installer/util/install_util.h" |
47 #include "chrome/installer/util/l10n_string_util.h" | 47 #include "chrome/installer/util/l10n_string_util.h" |
48 #include "chrome/installer/util/master_preferences.h" | 48 #include "chrome/installer/util/master_preferences.h" |
49 #include "chrome/installer/util/master_preferences_constants.h" | 49 #include "chrome/installer/util/master_preferences_constants.h" |
50 #include "chrome/installer/util/util_constants.h" | 50 #include "chrome/installer/util/util_constants.h" |
51 #include "chrome/installer/util/work_item.h" | 51 #include "chrome/installer/util/work_item.h" |
| 52 #include "content/public/common/registry_utils_win.h" |
52 | 53 |
53 #include "installer_util_strings.h" // NOLINT | 54 #include "installer_util_strings.h" // NOLINT |
54 | 55 |
55 using base::win::RegKey; | 56 using base::win::RegKey; |
56 | 57 |
57 namespace { | 58 namespace { |
58 | 59 |
59 // An enum used to tell QuickIsChromeRegistered() which level of registration | 60 // An enum used to tell QuickIsChromeRegistered() which level of registration |
60 // the caller wants to confirm. | 61 // the caller wants to confirm. |
61 enum RegistrationConfirmationLevel { | 62 enum RegistrationConfirmationLevel { |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 // In particular: | 433 // In particular: |
433 // - App Paths | 434 // - App Paths |
434 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 | 435 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 |
435 // - File Associations | 436 // - File Associations |
436 // http://msdn.microsoft.com/en-us/library/bb166549 | 437 // http://msdn.microsoft.com/en-us/library/bb166549 |
437 // These entries need to be registered in HKLM prior to Win8. | 438 // These entries need to be registered in HKLM prior to Win8. |
438 static void GetAppRegistrationEntries(const base::string16& chrome_exe, | 439 static void GetAppRegistrationEntries(const base::string16& chrome_exe, |
439 const base::string16& suffix, | 440 const base::string16& suffix, |
440 ScopedVector<RegistryEntry>* entries) { | 441 ScopedVector<RegistryEntry>* entries) { |
441 const base::FilePath chrome_path(chrome_exe); | 442 const base::FilePath chrome_path(chrome_exe); |
442 base::string16 app_path_key(ShellUtil::kAppPathsRegistryKey); | 443 base::string16 app_path_key(content::kRegistryAppsKey); |
443 app_path_key.push_back(base::FilePath::kSeparators[0]); | 444 app_path_key.push_back(base::FilePath::kSeparators[0]); |
444 app_path_key.append(chrome_path.BaseName().value()); | 445 app_path_key.append(chrome_path.BaseName().value()); |
445 entries->push_back(new RegistryEntry(app_path_key, chrome_exe)); | 446 entries->push_back(new RegistryEntry(app_path_key, chrome_exe)); |
446 entries->push_back(new RegistryEntry(app_path_key, | 447 entries->push_back(new RegistryEntry(app_path_key, |
447 ShellUtil::kAppPathsRegistryPathName, chrome_path.DirName().value())); | 448 content::kRegistryPath, chrome_path.DirName().value())); |
448 | 449 |
449 const base::string16 html_prog_id(GetBrowserProgId(suffix)); | 450 const base::string16 html_prog_id(GetBrowserProgId(suffix)); |
450 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { | 451 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { |
451 base::string16 key(ShellUtil::kRegClasses); | 452 base::string16 key(ShellUtil::kRegClasses); |
452 key.push_back(base::FilePath::kSeparators[0]); | 453 key.push_back(base::FilePath::kSeparators[0]); |
453 key.append(ShellUtil::kPotentialFileAssociations[i]); | 454 key.append(ShellUtil::kPotentialFileAssociations[i]); |
454 key.push_back(base::FilePath::kSeparators[0]); | 455 key.push_back(base::FilePath::kSeparators[0]); |
455 key.append(ShellUtil::kRegOpenWithProgids); | 456 key.append(ShellUtil::kRegOpenWithProgids); |
456 entries->push_back( | 457 entries->push_back( |
457 new RegistryEntry(key, html_prog_id, base::string16())); | 458 new RegistryEntry(key, html_prog_id, base::string16())); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 const wchar_t* ShellUtil::kRegShellPath = L"\\shell"; | 1397 const wchar_t* ShellUtil::kRegShellPath = L"\\shell"; |
1397 const wchar_t* ShellUtil::kRegShellOpen = L"\\shell\\open\\command"; | 1398 const wchar_t* ShellUtil::kRegShellOpen = L"\\shell\\open\\command"; |
1398 const wchar_t* ShellUtil::kRegStartMenuInternet = | 1399 const wchar_t* ShellUtil::kRegStartMenuInternet = |
1399 L"Software\\Clients\\StartMenuInternet"; | 1400 L"Software\\Clients\\StartMenuInternet"; |
1400 const wchar_t* ShellUtil::kRegClasses = L"Software\\Classes"; | 1401 const wchar_t* ShellUtil::kRegClasses = L"Software\\Classes"; |
1401 const wchar_t* ShellUtil::kRegRegisteredApplications = | 1402 const wchar_t* ShellUtil::kRegRegisteredApplications = |
1402 L"Software\\RegisteredApplications"; | 1403 L"Software\\RegisteredApplications"; |
1403 const wchar_t* ShellUtil::kRegVistaUrlPrefs = | 1404 const wchar_t* ShellUtil::kRegVistaUrlPrefs = |
1404 L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\" | 1405 L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\" |
1405 L"http\\UserChoice"; | 1406 L"http\\UserChoice"; |
1406 const wchar_t* ShellUtil::kAppPathsRegistryKey = | |
1407 L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths"; | |
1408 const wchar_t* ShellUtil::kAppPathsRegistryPathName = L"Path"; | |
1409 | 1407 |
1410 const wchar_t* ShellUtil::kDefaultFileAssociations[] = {L".htm", L".html", | 1408 const wchar_t* ShellUtil::kDefaultFileAssociations[] = {L".htm", L".html", |
1411 L".shtml", L".xht", L".xhtml", NULL}; | 1409 L".shtml", L".xht", L".xhtml", NULL}; |
1412 const wchar_t* ShellUtil::kPotentialFileAssociations[] = {L".htm", L".html", | 1410 const wchar_t* ShellUtil::kPotentialFileAssociations[] = {L".htm", L".html", |
1413 L".shtml", L".xht", L".xhtml", L".webp", NULL}; | 1411 L".shtml", L".xht", L".xhtml", L".webp", NULL}; |
1414 const wchar_t* ShellUtil::kBrowserProtocolAssociations[] = {L"ftp", L"http", | 1412 const wchar_t* ShellUtil::kBrowserProtocolAssociations[] = {L"ftp", L"http", |
1415 L"https", NULL}; | 1413 L"https", NULL}; |
1416 const wchar_t* ShellUtil::kPotentialProtocolAssociations[] = {L"ftp", L"http", | 1414 const wchar_t* ShellUtil::kPotentialProtocolAssociations[] = {L"ftp", L"http", |
1417 L"https", L"irc", L"mailto", L"mms", L"news", L"nntp", L"sms", L"smsto", | 1415 L"https", L"irc", L"mailto", L"mms", L"news", L"nntp", L"sms", L"smsto", |
1418 L"tel", L"urn", L"webcal", NULL}; | 1416 L"tel", L"urn", L"webcal", NULL}; |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 // are any left...). | 2269 // are any left...). |
2272 if (free_bits >= 8 && next_byte_index < size) { | 2270 if (free_bits >= 8 && next_byte_index < size) { |
2273 free_bits -= 8; | 2271 free_bits -= 8; |
2274 bit_stream += bytes[next_byte_index++] << free_bits; | 2272 bit_stream += bytes[next_byte_index++] << free_bits; |
2275 } | 2273 } |
2276 } | 2274 } |
2277 | 2275 |
2278 DCHECK_EQ(ret.length(), encoded_length); | 2276 DCHECK_EQ(ret.length(), encoded_length); |
2279 return ret; | 2277 return ret; |
2280 } | 2278 } |
OLD | NEW |