Chromium Code Reviews| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 } | 211 } |
| 212 | 212 |
| 213 // This method returns a list of all the registry entries that | 213 // This method returns a list of all the registry entries that |
| 214 // are needed to register this installation's ProgId and AppId. | 214 // are needed to register this installation's ProgId and AppId. |
| 215 // These entries need to be registered in HKLM prior to Win8. | 215 // These entries need to be registered in HKLM prior to Win8. |
| 216 static void GetProgIdEntries(BrowserDistribution* dist, | 216 static void GetProgIdEntries(BrowserDistribution* dist, |
| 217 const string16& chrome_exe, | 217 const string16& chrome_exe, |
| 218 const string16& suffix, | 218 const string16& suffix, |
| 219 ScopedVector<RegistryEntry>* entries) { | 219 ScopedVector<RegistryEntry>* entries) { |
| 220 string16 icon_path( | 220 string16 icon_path( |
| 221 ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex())); | 221 ShellUtil::FormatIconLocation(chrome_exe, dist-> |
| 222 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index)); | |
|
gab
2013/05/18 23:57:22
In general for this sort of wrapping use something
calamity
2013/05/24 02:03:11
Done.
| |
| 222 string16 open_cmd(ShellUtil::GetChromeShellOpenCmd(chrome_exe)); | 223 string16 open_cmd(ShellUtil::GetChromeShellOpenCmd(chrome_exe)); |
| 223 string16 delegate_command(ShellUtil::GetChromeDelegateCommand(chrome_exe)); | 224 string16 delegate_command(ShellUtil::GetChromeDelegateCommand(chrome_exe)); |
| 224 // For user-level installs: entries for the app id and DelegateExecute verb | 225 // For user-level installs: entries for the app id and DelegateExecute verb |
| 225 // handler will be in HKCU; thus we do not need a suffix on those entries. | 226 // handler will be in HKCU; thus we do not need a suffix on those entries. |
| 226 string16 app_id( | 227 string16 app_id( |
| 227 ShellUtil::GetBrowserModelId( | 228 ShellUtil::GetBrowserModelId( |
| 228 dist, InstallUtil::IsPerUserInstall(chrome_exe.c_str()))); | 229 dist, InstallUtil::IsPerUserInstall(chrome_exe.c_str()))); |
| 229 string16 delegate_guid; | 230 string16 delegate_guid; |
| 230 bool set_delegate_execute = | 231 bool set_delegate_execute = |
| 231 IsChromeMetroSupported() && | 232 IsChromeMetroSupported() && |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 string16 chrome_application(chrome_html_prog_id + | 310 string16 chrome_application(chrome_html_prog_id + |
| 310 ShellUtil::kRegApplication); | 311 ShellUtil::kRegApplication); |
| 311 entries->push_back(new RegistryEntry( | 312 entries->push_back(new RegistryEntry( |
| 312 chrome_application, ShellUtil::kRegAppUserModelId, app_id)); | 313 chrome_application, ShellUtil::kRegAppUserModelId, app_id)); |
| 313 entries->push_back(new RegistryEntry( | 314 entries->push_back(new RegistryEntry( |
| 314 chrome_application, ShellUtil::kRegApplicationIcon, icon_path)); | 315 chrome_application, ShellUtil::kRegApplicationIcon, icon_path)); |
| 315 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 316 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
| 316 // resource for name, description, and company. | 317 // resource for name, description, and company. |
| 317 entries->push_back(new RegistryEntry( | 318 entries->push_back(new RegistryEntry( |
| 318 chrome_application, ShellUtil::kRegApplicationName, | 319 chrome_application, ShellUtil::kRegApplicationName, |
| 319 dist->GetAppShortCutName())); | 320 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name)); |
|
huangs
2013/05/21 21:35:41
Might need another "name" routine; see comment in
| |
| 320 entries->push_back(new RegistryEntry( | 321 entries->push_back(new RegistryEntry( |
| 321 chrome_application, ShellUtil::kRegApplicationDescription, | 322 chrome_application, ShellUtil::kRegApplicationDescription, |
| 322 dist->GetAppDescription())); | 323 dist->GetAppDescription())); |
| 323 entries->push_back(new RegistryEntry( | 324 entries->push_back(new RegistryEntry( |
| 324 chrome_application, ShellUtil::kRegApplicationCompany, | 325 chrome_application, ShellUtil::kRegApplicationCompany, |
| 325 dist->GetPublisherName())); | 326 dist->GetPublisherName())); |
| 326 } | 327 } |
| 327 } | 328 } |
| 328 | 329 |
| 329 // This method returns a list of the registry entries needed to declare a | 330 // This method returns a list of the registry entries needed to declare a |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 342 // this installation in "RegisteredApplications" on Windows (to appear in | 343 // this installation in "RegisteredApplications" on Windows (to appear in |
| 343 // Default Programs, StartMenuInternet, etc.). | 344 // Default Programs, StartMenuInternet, etc.). |
| 344 // These entries need to be registered in HKLM prior to Win8. | 345 // These entries need to be registered in HKLM prior to Win8. |
| 345 // If |suffix| is not empty, these entries are guaranteed to be unique on this | 346 // If |suffix| is not empty, these entries are guaranteed to be unique on this |
| 346 // machine. | 347 // machine. |
| 347 static void GetShellIntegrationEntries(BrowserDistribution* dist, | 348 static void GetShellIntegrationEntries(BrowserDistribution* dist, |
| 348 const string16& chrome_exe, | 349 const string16& chrome_exe, |
| 349 const string16& suffix, | 350 const string16& suffix, |
| 350 ScopedVector<RegistryEntry>* entries) { | 351 ScopedVector<RegistryEntry>* entries) { |
| 351 const string16 icon_path( | 352 const string16 icon_path( |
| 352 ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex())); | 353 ShellUtil::FormatIconLocation(chrome_exe, dist-> |
| 354 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index)); | |
| 353 const string16 quoted_exe_path(L"\"" + chrome_exe + L"\""); | 355 const string16 quoted_exe_path(L"\"" + chrome_exe + L"\""); |
| 354 | 356 |
| 355 // Register for the Start Menu "Internet" link (pre-Win7). | 357 // Register for the Start Menu "Internet" link (pre-Win7). |
| 356 const string16 start_menu_entry(GetBrowserClientKey(dist, suffix)); | 358 const string16 start_menu_entry(GetBrowserClientKey(dist, suffix)); |
| 357 // Register Chrome's display name. | 359 // Register Chrome's display name. |
| 358 // TODO(grt): http://crbug.com/75152 Also set LocalizedString; see | 360 // TODO(grt): http://crbug.com/75152 Also set LocalizedString; see |
| 359 // http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109(v=VS.85) .aspx#registering_the_display_name | 361 // http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109(v=VS.85) .aspx#registering_the_display_name |
| 360 entries->push_back(new RegistryEntry( | 362 entries->push_back(new RegistryEntry( |
| 361 start_menu_entry, dist->GetAppShortCutName())); | 363 start_menu_entry, |
| 364 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name)); | |
|
huangs
2013/05/21 21:35:41
Might need another "name" routine; see comment in
| |
| 362 // Register the "open" verb for launching Chrome via the "Internet" link. | 365 // Register the "open" verb for launching Chrome via the "Internet" link. |
| 363 entries->push_back(new RegistryEntry( | 366 entries->push_back(new RegistryEntry( |
| 364 start_menu_entry + ShellUtil::kRegShellOpen, quoted_exe_path)); | 367 start_menu_entry + ShellUtil::kRegShellOpen, quoted_exe_path)); |
| 365 // Register Chrome's icon for the Start Menu "Internet" link. | 368 // Register Chrome's icon for the Start Menu "Internet" link. |
| 366 entries->push_back(new RegistryEntry( | 369 entries->push_back(new RegistryEntry( |
| 367 start_menu_entry + ShellUtil::kRegDefaultIcon, icon_path)); | 370 start_menu_entry + ShellUtil::kRegDefaultIcon, icon_path)); |
| 368 | 371 |
| 369 // Register installation information. | 372 // Register installation information. |
| 370 string16 install_info(start_menu_entry + L"\\InstallInfo"); | 373 string16 install_info(start_menu_entry + L"\\InstallInfo"); |
| 371 // Note: not using CommandLine since it has ambiguous rules for quoting | 374 // Note: not using CommandLine since it has ambiguous rules for quoting |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 387 // Write out Chrome's Default Programs info. | 390 // Write out Chrome's Default Programs info. |
| 388 // TODO(grt): http://crbug.com/75152 Write a reference to a localized | 391 // TODO(grt): http://crbug.com/75152 Write a reference to a localized |
| 389 // resource rather than this. | 392 // resource rather than this. |
| 390 entries->push_back(new RegistryEntry( | 393 entries->push_back(new RegistryEntry( |
| 391 capabilities, ShellUtil::kRegApplicationDescription, | 394 capabilities, ShellUtil::kRegApplicationDescription, |
| 392 dist->GetLongAppDescription())); | 395 dist->GetLongAppDescription())); |
| 393 entries->push_back(new RegistryEntry( | 396 entries->push_back(new RegistryEntry( |
| 394 capabilities, ShellUtil::kRegApplicationIcon, icon_path)); | 397 capabilities, ShellUtil::kRegApplicationIcon, icon_path)); |
| 395 entries->push_back(new RegistryEntry( | 398 entries->push_back(new RegistryEntry( |
| 396 capabilities, ShellUtil::kRegApplicationName, | 399 capabilities, ShellUtil::kRegApplicationName, |
| 397 dist->GetAppShortCutName())); | 400 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name)); |
| 398 | 401 |
| 399 entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu", | 402 entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu", |
| 400 L"StartMenuInternet", reg_app_name)); | 403 L"StartMenuInternet", reg_app_name)); |
| 401 | 404 |
| 402 const string16 html_prog_id(GetBrowserProgId(suffix)); | 405 const string16 html_prog_id(GetBrowserProgId(suffix)); |
| 403 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { | 406 for (int i = 0; ShellUtil::kPotentialFileAssociations[i] != NULL; i++) { |
| 404 entries->push_back(new RegistryEntry( | 407 entries->push_back(new RegistryEntry( |
| 405 capabilities + L"\\FileAssociations", | 408 capabilities + L"\\FileAssociations", |
| 406 ShellUtil::kPotentialFileAssociations[i], html_prog_id)); | 409 ShellUtil::kPotentialFileAssociations[i], html_prog_id)); |
| 407 } | 410 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 for (int i = 0; ShellUtil::kDefaultFileAssociations[i] != NULL; i++) { | 496 for (int i = 0; ShellUtil::kDefaultFileAssociations[i] != NULL; i++) { |
| 494 string16 ext_key(ShellUtil::kRegClasses); | 497 string16 ext_key(ShellUtil::kRegClasses); |
| 495 ext_key.push_back(base::FilePath::kSeparators[0]); | 498 ext_key.push_back(base::FilePath::kSeparators[0]); |
| 496 ext_key.append(ShellUtil::kDefaultFileAssociations[i]); | 499 ext_key.append(ShellUtil::kDefaultFileAssociations[i]); |
| 497 entries->push_back(new RegistryEntry(ext_key, html_prog_id)); | 500 entries->push_back(new RegistryEntry(ext_key, html_prog_id)); |
| 498 } | 501 } |
| 499 | 502 |
| 500 // Protocols associations. | 503 // Protocols associations. |
| 501 string16 chrome_open = ShellUtil::GetChromeShellOpenCmd(chrome_exe); | 504 string16 chrome_open = ShellUtil::GetChromeShellOpenCmd(chrome_exe); |
| 502 string16 chrome_icon = | 505 string16 chrome_icon = |
| 503 ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex()); | 506 ShellUtil::FormatIconLocation(chrome_exe, dist-> |
| 507 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index); | |
| 504 for (int i = 0; ShellUtil::kBrowserProtocolAssociations[i] != NULL; i++) { | 508 for (int i = 0; ShellUtil::kBrowserProtocolAssociations[i] != NULL; i++) { |
| 505 GetXPStyleUserProtocolEntries(ShellUtil::kBrowserProtocolAssociations[i], | 509 GetXPStyleUserProtocolEntries(ShellUtil::kBrowserProtocolAssociations[i], |
| 506 chrome_icon, chrome_open, entries); | 510 chrome_icon, chrome_open, entries); |
| 507 } | 511 } |
| 508 | 512 |
| 509 // start->Internet shortcut. | 513 // start->Internet shortcut. |
| 510 string16 start_menu(ShellUtil::kRegStartMenuInternet); | 514 string16 start_menu(ShellUtil::kRegStartMenuInternet); |
| 511 string16 app_name = dist->GetBaseAppName() + suffix; | 515 string16 app_name = dist->GetBaseAppName() + suffix; |
| 512 entries->push_back(new RegistryEntry(start_menu, app_name)); | 516 entries->push_back(new RegistryEntry(start_menu, app_name)); |
| 513 } | 517 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 898 // Associates Chrome with |protocol| in the registry. This should not be | 902 // Associates Chrome with |protocol| in the registry. This should not be |
| 899 // required on Vista+ but since some applications still read these registry | 903 // required on Vista+ but since some applications still read these registry |
| 900 // keys directly, we have to do this on Vista+ as well. | 904 // keys directly, we have to do this on Vista+ as well. |
| 901 // See http://msdn.microsoft.com/library/aa767914.aspx for more details. | 905 // See http://msdn.microsoft.com/library/aa767914.aspx for more details. |
| 902 bool RegisterChromeAsDefaultProtocolClientXPStyle(BrowserDistribution* dist, | 906 bool RegisterChromeAsDefaultProtocolClientXPStyle(BrowserDistribution* dist, |
| 903 const string16& chrome_exe, | 907 const string16& chrome_exe, |
| 904 const string16& protocol) { | 908 const string16& protocol) { |
| 905 ScopedVector<RegistryEntry> entries; | 909 ScopedVector<RegistryEntry> entries; |
| 906 const string16 chrome_open(ShellUtil::GetChromeShellOpenCmd(chrome_exe)); | 910 const string16 chrome_open(ShellUtil::GetChromeShellOpenCmd(chrome_exe)); |
| 907 const string16 chrome_icon( | 911 const string16 chrome_icon( |
| 908 ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex())); | 912 ShellUtil::FormatIconLocation(chrome_exe, |
| 913 dist-> | |
| 914 GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index)); | |
| 909 RegistryEntry::GetXPStyleUserProtocolEntries(protocol, chrome_icon, | 915 RegistryEntry::GetXPStyleUserProtocolEntries(protocol, chrome_icon, |
| 910 chrome_open, &entries); | 916 chrome_open, &entries); |
| 911 // Change the default protocol handler for current user. | 917 // Change the default protocol handler for current user. |
| 912 if (!AddRegistryEntries(HKEY_CURRENT_USER, entries)) { | 918 if (!AddRegistryEntries(HKEY_CURRENT_USER, entries)) { |
| 913 LOG(ERROR) << "Could not make Chrome default protocol client (XP)."; | 919 LOG(ERROR) << "Could not make Chrome default protocol client (XP)."; |
| 914 return false; | 920 return false; |
| 915 } | 921 } |
| 916 | 922 |
| 917 return true; | 923 return true; |
| 918 } | 924 } |
| 919 | 925 |
| 920 // Returns |properties.shortcut_name| if the property is set, otherwise it | 926 // Returns |properties.shortcut_name| if the property is set, otherwise it |
| 921 // returns dist->GetAppShortcutName(). In any case, it makes sure the | 927 // returns dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name. In |
| 922 // return value is suffixed with ".lnk". | 928 // any case, it makes sure the return value is suffixed with ".lnk". |
| 923 string16 ExtractShortcutNameFromProperties( | 929 string16 ExtractShortcutNameFromProperties( |
| 924 BrowserDistribution* dist, | 930 BrowserDistribution* dist, |
| 925 const ShellUtil::ShortcutProperties& properties) { | 931 const ShellUtil::ShortcutProperties& properties) { |
| 926 DCHECK(dist); | 932 DCHECK(dist); |
| 927 string16 shortcut_name; | 933 string16 shortcut_name; |
|
huangs
2013/05/21 21:35:41
string shortcut_name(
properties.has_shortcut_
calamity
2013/05/24 02:03:11
Done.
calamity
2013/05/24 02:03:11
Done.
| |
| 928 if (properties.has_shortcut_name()) | 934 if (properties.has_shortcut_name()) { |
| 929 shortcut_name = properties.shortcut_name; | 935 shortcut_name = properties.shortcut_name; |
| 930 else | 936 } else { |
| 931 shortcut_name = dist->GetAppShortCutName(); | 937 shortcut_name = |
| 938 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name; | |
| 939 } | |
| 932 | 940 |
| 933 if (!EndsWith(shortcut_name, installer::kLnkExt, false)) | 941 if (!EndsWith(shortcut_name, installer::kLnkExt, false)) |
| 934 shortcut_name.append(installer::kLnkExt); | 942 shortcut_name.append(installer::kLnkExt); |
| 935 | 943 |
| 936 return shortcut_name; | 944 return shortcut_name; |
| 937 } | 945 } |
| 938 | 946 |
| 939 // Converts ShellUtil::ShortcutOperation to the best-matching value in | 947 // Converts ShellUtil::ShortcutOperation to the best-matching value in |
| 940 // base::win::ShortcutOperation. | 948 // base::win::ShortcutOperation. |
| 941 base::win::ShortcutOperation TranslateShortcutOperation( | 949 base::win::ShortcutOperation TranslateShortcutOperation( |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1389 default: | 1397 default: |
| 1390 NOTREACHED(); | 1398 NOTREACHED(); |
| 1391 return false; | 1399 return false; |
| 1392 } | 1400 } |
| 1393 | 1401 |
| 1394 if (!PathService::Get(dir_key, path) || path->empty()) { | 1402 if (!PathService::Get(dir_key, path) || path->empty()) { |
| 1395 NOTREACHED() << dir_key; | 1403 NOTREACHED() << dir_key; |
| 1396 return false; | 1404 return false; |
| 1397 } | 1405 } |
| 1398 | 1406 |
| 1399 if (add_folder_for_dist) | 1407 if (add_folder_for_dist) { |
| 1400 *path = path->Append(dist->GetAppShortCutName()); | 1408 *path = path->Append( |
| 1409 dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name); | |
|
huangs
2013/05/21 21:35:41
Add TODO.
calamity
2013/05/24 02:03:11
Done.
| |
| 1410 } | |
| 1401 | 1411 |
| 1402 return true; | 1412 return true; |
| 1403 } | 1413 } |
| 1404 | 1414 |
| 1405 bool ShellUtil::CreateOrUpdateShortcut( | 1415 bool ShellUtil::CreateOrUpdateShortcut( |
| 1406 ShellUtil::ShortcutLocation location, | 1416 ShellUtil::ShortcutLocation location, |
| 1407 BrowserDistribution* dist, | 1417 BrowserDistribution* dist, |
| 1408 const ShellUtil::ShortcutProperties& properties, | 1418 const ShellUtil::ShortcutProperties& properties, |
| 1409 ShellUtil::ShortcutOperation operation) { | 1419 ShellUtil::ShortcutOperation operation) { |
| 1410 // Explicitly whitelist locations to which this is applicable. | 1420 // Explicitly whitelist locations to which this is applicable. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1483 base::win::GetVersion() >= base::win::VERSION_WIN7) { | 1493 base::win::GetVersion() >= base::win::VERSION_WIN7) { |
| 1484 ret = base::win::TaskbarPinShortcutLink(chosen_path->value().c_str()); | 1494 ret = base::win::TaskbarPinShortcutLink(chosen_path->value().c_str()); |
| 1485 if (!ret) { | 1495 if (!ret) { |
| 1486 LOG(ERROR) << "Failed to pin " << chosen_path->value(); | 1496 LOG(ERROR) << "Failed to pin " << chosen_path->value(); |
| 1487 } | 1497 } |
| 1488 } | 1498 } |
| 1489 | 1499 |
| 1490 return ret; | 1500 return ret; |
| 1491 } | 1501 } |
| 1492 | 1502 |
| 1493 string16 ShellUtil::FormatIconLocation(const string16& icon_path, | 1503 string16 ShellUtil::FormatIconLocation(const string16& icon_path, |
|
huangs
2013/05/21 21:35:41
This is a convenience routine. Consider replacing
calamity
2013/05/24 02:03:11
Any reason we pass in an icon_path? Shouldn't Shor
gab
2013/05/24 15:01:35
Distributions with an empty string16 as the icon f
gab
2013/05/24 15:01:35
I agree with Sam though that for convenience for t
| |
| 1494 int icon_index) { | 1504 int icon_index) { |
| 1495 string16 icon_string(icon_path); | 1505 string16 icon_string(icon_path); |
| 1496 icon_string.append(L","); | 1506 icon_string.append(L","); |
| 1497 icon_string.append(base::IntToString16(icon_index)); | 1507 icon_string.append(base::IntToString16(icon_index)); |
| 1498 return icon_string; | 1508 return icon_string; |
| 1499 } | 1509 } |
| 1500 | 1510 |
| 1501 string16 ShellUtil::GetChromeShellOpenCmd(const string16& chrome_exe) { | 1511 string16 ShellUtil::GetChromeShellOpenCmd(const string16& chrome_exe) { |
| 1502 return L"\"" + chrome_exe + L"\" -- \"%1\""; | 1512 return L"\"" + chrome_exe + L"\" -- \"%1\""; |
| 1503 } | 1513 } |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2080 // are any left...). | 2090 // are any left...). |
| 2081 if (free_bits >= 8 && next_byte_index < size) { | 2091 if (free_bits >= 8 && next_byte_index < size) { |
| 2082 free_bits -= 8; | 2092 free_bits -= 8; |
| 2083 bit_stream += bytes[next_byte_index++] << free_bits; | 2093 bit_stream += bytes[next_byte_index++] << free_bits; |
| 2084 } | 2094 } |
| 2085 } | 2095 } |
| 2086 | 2096 |
| 2087 DCHECK_EQ(ret.length(), encoded_length); | 2097 DCHECK_EQ(ret.length(), encoded_length); |
| 2088 return ret; | 2098 return ret; |
| 2089 } | 2099 } |
| OLD | NEW |