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

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

Issue 432273005: Fix shortcut tests and remove legacy shortcut code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 base::FilePath* path) { 1467 base::FilePath* path) {
1468 DCHECK(path); 1468 DCHECK(path);
1469 int dir_key = -1; 1469 int dir_key = -1;
1470 base::string16 folder_to_append; 1470 base::string16 folder_to_append;
1471 switch (location) { 1471 switch (location) {
1472 case SHORTCUT_LOCATION_DESKTOP: 1472 case SHORTCUT_LOCATION_DESKTOP:
1473 dir_key = (level == CURRENT_USER) ? base::DIR_USER_DESKTOP : 1473 dir_key = (level == CURRENT_USER) ? base::DIR_USER_DESKTOP :
1474 base::DIR_COMMON_DESKTOP; 1474 base::DIR_COMMON_DESKTOP;
1475 break; 1475 break;
1476 case SHORTCUT_LOCATION_QUICK_LAUNCH: 1476 case SHORTCUT_LOCATION_QUICK_LAUNCH:
1477 dir_key = (level == CURRENT_USER) ? base::DIR_USER_QUICK_LAUNCH : 1477 // There is no support for a system-level Quick Launch shortcut.
1478 base::DIR_DEFAULT_USER_QUICK_LAUNCH; 1478 DCHECK_EQ(level, CURRENT_USER);
1479 dir_key = base::DIR_USER_QUICK_LAUNCH;
1479 break; 1480 break;
1480 case SHORTCUT_LOCATION_START_MENU_ROOT: 1481 case SHORTCUT_LOCATION_START_MENU_ROOT:
1481 dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : 1482 dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU :
1482 base::DIR_COMMON_START_MENU; 1483 base::DIR_COMMON_START_MENU;
1483 break; 1484 break;
1484 case SHORTCUT_LOCATION_START_MENU_CHROME_DIR: 1485 case SHORTCUT_LOCATION_START_MENU_CHROME_DIR:
1485 dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : 1486 dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU :
1486 base::DIR_COMMON_START_MENU; 1487 base::DIR_COMMON_START_MENU;
1487 folder_to_append = dist->GetStartMenuShortcutSubfolder( 1488 folder_to_append = dist->GetStartMenuShortcutSubfolder(
1488 BrowserDistribution::SUBFOLDER_CHROME); 1489 BrowserDistribution::SUBFOLDER_CHROME);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 } 1533 }
1533 1534
1534 DCHECK(dist); 1535 DCHECK(dist);
1535 // |pin_to_taskbar| is only acknowledged when first creating the shortcut. 1536 // |pin_to_taskbar| is only acknowledged when first creating the shortcut.
1536 DCHECK(!properties.pin_to_taskbar || 1537 DCHECK(!properties.pin_to_taskbar ||
1537 operation == SHELL_SHORTCUT_CREATE_ALWAYS || 1538 operation == SHELL_SHORTCUT_CREATE_ALWAYS ||
1538 operation == SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL); 1539 operation == SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL);
1539 1540
1540 base::FilePath user_shortcut_path; 1541 base::FilePath user_shortcut_path;
1541 base::FilePath system_shortcut_path; 1542 base::FilePath system_shortcut_path;
1542 if (!GetShortcutPath(location, dist, SYSTEM_LEVEL, &system_shortcut_path)) { 1543 if (location == SHORTCUT_LOCATION_QUICK_LAUNCH) {
1544 // There is no system-level shortcut for Quick Launch.
1545 DCHECK_EQ(properties.level, CURRENT_USER);
1546 } else if (!GetShortcutPath(
1547 location, dist, SYSTEM_LEVEL, &system_shortcut_path)) {
1543 NOTREACHED(); 1548 NOTREACHED();
1544 return false; 1549 return false;
1545 } 1550 }
1546 1551
1547 base::string16 shortcut_name( 1552 base::string16 shortcut_name(
1548 ExtractShortcutNameFromProperties(dist, properties)); 1553 ExtractShortcutNameFromProperties(dist, properties));
1549 system_shortcut_path = system_shortcut_path.Append(shortcut_name); 1554 system_shortcut_path = system_shortcut_path.Append(shortcut_name);
1550 1555
1551 base::FilePath* chosen_path; 1556 base::FilePath* chosen_path;
1552 bool should_install_shortcut = true; 1557 bool should_install_shortcut = true;
1553 if (properties.level == SYSTEM_LEVEL) { 1558 if (properties.level == SYSTEM_LEVEL) {
1554 // Install the system-level shortcut if requested. 1559 // Install the system-level shortcut if requested.
1555 chosen_path = &system_shortcut_path; 1560 chosen_path = &system_shortcut_path;
1556 } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL || 1561 } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL ||
1562 system_shortcut_path.empty() ||
1557 !base::PathExists(system_shortcut_path)) { 1563 !base::PathExists(system_shortcut_path)) {
1558 // Otherwise install the user-level shortcut, unless the system-level 1564 // Otherwise install the user-level shortcut, unless the system-level
1559 // variant of this shortcut is present on the machine and |operation| states 1565 // variant of this shortcut is present on the machine and |operation| states
1560 // not to create a user-level shortcut in that case. 1566 // not to create a user-level shortcut in that case.
1561 if (!GetShortcutPath(location, dist, CURRENT_USER, &user_shortcut_path)) { 1567 if (!GetShortcutPath(location, dist, CURRENT_USER, &user_shortcut_path)) {
1562 NOTREACHED(); 1568 NOTREACHED();
1563 return false; 1569 return false;
1564 } 1570 }
1565 user_shortcut_path = user_shortcut_path.Append(shortcut_name); 1571 user_shortcut_path = user_shortcut_path.Append(shortcut_name);
1566 chosen_path = &user_shortcut_path; 1572 chosen_path = &user_shortcut_path;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 // are any left...). 2280 // are any left...).
2275 if (free_bits >= 8 && next_byte_index < size) { 2281 if (free_bits >= 8 && next_byte_index < size) {
2276 free_bits -= 8; 2282 free_bits -= 8;
2277 bit_stream += bytes[next_byte_index++] << free_bits; 2283 bit_stream += bytes[next_byte_index++] << free_bits;
2278 } 2284 }
2279 } 2285 }
2280 2286
2281 DCHECK_EQ(ret.length(), encoded_length); 2287 DCHECK_EQ(ret.length(), encoded_length);
2282 return ret; 2288 return ret;
2283 } 2289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698