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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 entries->push_back(new RegistryEntry( | 392 entries->push_back(new RegistryEntry( |
393 capabilities, ShellUtil::kRegApplicationIcon, icon_path)); | 393 capabilities, ShellUtil::kRegApplicationIcon, icon_path)); |
394 entries->push_back(new RegistryEntry( | 394 entries->push_back(new RegistryEntry( |
395 capabilities, ShellUtil::kRegApplicationName, | 395 capabilities, ShellUtil::kRegApplicationName, |
396 dist->GetAppShortCutName())); | 396 dist->GetAppShortCutName())); |
397 | 397 |
398 entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu", | 398 entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu", |
399 L"StartMenuInternet", reg_app_name)); | 399 L"StartMenuInternet", reg_app_name)); |
400 | 400 |
401 const string16 html_prog_id(GetBrowserProgId(suffix)); | 401 const string16 html_prog_id(GetBrowserProgId(suffix)); |
402 for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) { | 402 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { |
403 entries->push_back(new RegistryEntry( | 403 entries->push_back(new RegistryEntry( |
404 capabilities + L"\\FileAssociations", | 404 capabilities + L"\\FileAssociations", |
405 ShellUtil::kFileAssociations[i], html_prog_id)); | 405 ShellUtil::kPotentialFileAssociations[i], html_prog_id)); |
406 } | 406 } |
407 for (int i = 0; ShellUtil::kPotentialProtocolAssociations[i] != NULL; | 407 for (int i = 0; ShellUtil::kPotentialProtocolAssociations[i] != NULL; |
408 i++) { | 408 i++) { |
409 entries->push_back(new RegistryEntry( | 409 entries->push_back(new RegistryEntry( |
410 capabilities + L"\\URLAssociations", | 410 capabilities + L"\\URLAssociations", |
411 ShellUtil::kPotentialProtocolAssociations[i], html_prog_id)); | 411 ShellUtil::kPotentialProtocolAssociations[i], html_prog_id)); |
412 } | 412 } |
413 } | 413 } |
414 | 414 |
415 // This method returns a list of the registry entries required for this | 415 // This method returns a list of the registry entries required for this |
416 // installation to be registered in the Windows shell. | 416 // installation to be registered in the Windows shell. |
417 // In particular: | 417 // In particular: |
418 // - App Paths | 418 // - App Paths |
419 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 | 419 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 |
420 // - File Associations | 420 // - File Associations |
421 // http://msdn.microsoft.com/en-us/library/bb166549 | 421 // http://msdn.microsoft.com/en-us/library/bb166549 |
422 // These entries need to be registered in HKLM prior to Win8. | 422 // These entries need to be registered in HKLM prior to Win8. |
423 static void GetAppRegistrationEntries(const string16& chrome_exe, | 423 static void GetAppRegistrationEntries(const string16& chrome_exe, |
424 const string16& suffix, | 424 const string16& suffix, |
425 ScopedVector<RegistryEntry>* entries) { | 425 ScopedVector<RegistryEntry>* entries) { |
426 const base::FilePath chrome_path(chrome_exe); | 426 const base::FilePath chrome_path(chrome_exe); |
427 string16 app_path_key(ShellUtil::kAppPathsRegistryKey); | 427 string16 app_path_key(ShellUtil::kAppPathsRegistryKey); |
428 app_path_key.push_back(base::FilePath::kSeparators[0]); | 428 app_path_key.push_back(base::FilePath::kSeparators[0]); |
429 app_path_key.append(chrome_path.BaseName().value()); | 429 app_path_key.append(chrome_path.BaseName().value()); |
430 entries->push_back(new RegistryEntry(app_path_key, chrome_exe)); | 430 entries->push_back(new RegistryEntry(app_path_key, chrome_exe)); |
431 entries->push_back(new RegistryEntry(app_path_key, | 431 entries->push_back(new RegistryEntry(app_path_key, |
432 ShellUtil::kAppPathsRegistryPathName, chrome_path.DirName().value())); | 432 ShellUtil::kAppPathsRegistryPathName, chrome_path.DirName().value())); |
433 | 433 |
434 const string16 html_prog_id(GetBrowserProgId(suffix)); | 434 const string16 html_prog_id(GetBrowserProgId(suffix)); |
435 for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) { | 435 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { |
436 string16 key(ShellUtil::kRegClasses); | 436 string16 key(ShellUtil::kRegClasses); |
437 key.push_back(base::FilePath::kSeparators[0]); | 437 key.push_back(base::FilePath::kSeparators[0]); |
438 key.append(ShellUtil::kFileAssociations[i]); | 438 key.append(ShellUtil::kPotentialFileAssociations[i]); |
439 key.push_back(base::FilePath::kSeparators[0]); | 439 key.push_back(base::FilePath::kSeparators[0]); |
440 key.append(ShellUtil::kRegOpenWithProgids); | 440 key.append(ShellUtil::kRegOpenWithProgids); |
441 entries->push_back(new RegistryEntry(key, html_prog_id, string16())); | 441 entries->push_back(new RegistryEntry(key, html_prog_id, string16())); |
442 } | 442 } |
443 } | 443 } |
444 | 444 |
445 // This method returns a list of all the user level registry entries that | 445 // This method returns a list of all the user level registry entries that |
446 // are needed to make Chromium the default handler for a protocol on XP. | 446 // are needed to make Chromium the default handler for a protocol on XP. |
447 static void GetXPStyleUserProtocolEntries( | 447 static void GetXPStyleUserProtocolEntries( |
448 const string16& protocol, | 448 const string16& protocol, |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1213 // because of http://crbug.com/153349 as with the '.' and 26 characters suffix | 1213 // because of http://crbug.com/153349 as with the '.' and 26 characters suffix |
1214 // added on user-level installs, the generated progid for Chromium was 39 | 1214 // added on user-level installs, the generated progid for Chromium was 39 |
1215 // characters long which, according to MSDN ( | 1215 // characters long which, according to MSDN ( |
1216 // http://msdn.microsoft.com/library/aa911706.aspx), is the maximum length | 1216 // http://msdn.microsoft.com/library/aa911706.aspx), is the maximum length |
1217 // for a progid. It was however determined through experimentation that the 39 | 1217 // for a progid. It was however determined through experimentation that the 39 |
1218 // character limit mentioned on MSDN includes the NULL character... | 1218 // character limit mentioned on MSDN includes the NULL character... |
1219 const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromiumHTM"; | 1219 const wchar_t* ShellUtil::kChromeHTMLProgId = L"ChromiumHTM"; |
1220 const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chromium HTML Document"; | 1220 const wchar_t* ShellUtil::kChromeHTMLProgIdDesc = L"Chromium HTML Document"; |
1221 #endif | 1221 #endif |
1222 | 1222 |
1223 const wchar_t* ShellUtil::kFileAssociations[] = {L".htm", L".html", L".shtml", | 1223 const wchar_t* ShellUtil::kFileAssociations[] = {L".htm", L".html", L".shtml", |
gab
2013/04/29 21:15:04
nit: Please rename this to kDefaultFileAssociation
Stephen
2013/04/30 04:08:37
Done.
| |
1224 L".xht", L".xhtml", NULL}; | 1224 L".xht", L".xhtml", NULL}; |
1225 const wchar_t* ShellUtil::kPotentialFileAssociations[] = {L".htm", L".html", | |
1226 L".shtml", L".xht", L".xhtml", L".webp", NULL}; | |
1225 const wchar_t* ShellUtil::kBrowserProtocolAssociations[] = {L"ftp", L"http", | 1227 const wchar_t* ShellUtil::kBrowserProtocolAssociations[] = {L"ftp", L"http", |
1226 L"https", NULL}; | 1228 L"https", NULL}; |
1227 const wchar_t* ShellUtil::kPotentialProtocolAssociations[] = {L"ftp", L"http", | 1229 const wchar_t* ShellUtil::kPotentialProtocolAssociations[] = {L"ftp", L"http", |
1228 L"https", L"irc", L"mailto", L"mms", L"news", L"nntp", L"sms", L"smsto", | 1230 L"https", L"irc", L"mailto", L"mms", L"news", L"nntp", L"sms", L"smsto", |
1229 L"tel", L"urn", L"webcal", NULL}; | 1231 L"tel", L"urn", L"webcal", NULL}; |
1230 const wchar_t* ShellUtil::kRegUrlProtocol = L"URL Protocol"; | 1232 const wchar_t* ShellUtil::kRegUrlProtocol = L"URL Protocol"; |
1231 const wchar_t* ShellUtil::kRegApplication = L"\\Application"; | 1233 const wchar_t* ShellUtil::kRegApplication = L"\\Application"; |
1232 const wchar_t* ShellUtil::kRegAppUserModelId = L"AppUserModelId"; | 1234 const wchar_t* ShellUtil::kRegAppUserModelId = L"AppUserModelId"; |
1233 const wchar_t* ShellUtil::kRegApplicationDescription = | 1235 const wchar_t* ShellUtil::kRegApplicationDescription = |
1234 L"ApplicationDescription"; | 1236 L"ApplicationDescription"; |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2018 // are any left...). | 2020 // are any left...). |
2019 if (free_bits >= 8 && next_byte_index < size) { | 2021 if (free_bits >= 8 && next_byte_index < size) { |
2020 free_bits -= 8; | 2022 free_bits -= 8; |
2021 bit_stream += bytes[next_byte_index++] << free_bits; | 2023 bit_stream += bytes[next_byte_index++] << free_bits; |
2022 } | 2024 } |
2023 } | 2025 } |
2024 | 2026 |
2025 DCHECK_EQ(ret.length(), encoded_length); | 2027 DCHECK_EQ(ret.length(), encoded_length); |
2026 return ret; | 2028 return ret; |
2027 } | 2029 } |
OLD | NEW |