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 #include "chrome/browser/web_applications/web_app_win.h" | 5 #include "chrome/browser/web_applications/web_app_win.h" |
| 6 | 6 |
| 7 #include <shlobj.h> | 7 #include <shlobj.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 | 558 |
| 559 std::vector<base::FilePath> GetShortcutPaths( | 559 std::vector<base::FilePath> GetShortcutPaths( |
| 560 const ShortcutLocations& creation_locations) { | 560 const ShortcutLocations& creation_locations) { |
| 561 // Shortcut paths under which to create shortcuts. | 561 // Shortcut paths under which to create shortcuts. |
| 562 std::vector<base::FilePath> shortcut_paths; | 562 std::vector<base::FilePath> shortcut_paths; |
| 563 // Locations to add to shortcut_paths. | 563 // Locations to add to shortcut_paths. |
| 564 struct { | 564 struct { |
| 565 bool use_this_location; | 565 bool use_this_location; |
| 566 ShellUtil::ShortcutLocation location_id; | 566 ShellUtil::ShortcutLocation location_id; |
| 567 } locations[] = { | 567 } locations[] = { |
| 568 { | 568 {creation_locations.on_desktop, ShellUtil::SHORTCUT_LOCATION_DESKTOP}, |
|
grt (UTC plus 2)
2015/10/22 17:31:11
"git cl format" is very useful, but sometimes does
bcwhite
2015/10/23 17:22:14
Done.
| |
| 569 creation_locations.on_desktop, | 569 {creation_locations.applications_menu_location == APP_MENU_LOCATION_ROOT, |
| 570 ShellUtil::SHORTCUT_LOCATION_DESKTOP | 570 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT}, |
| 571 }, { | 571 {creation_locations.applications_menu_location == |
| 572 creation_locations.applications_menu_location == APP_MENU_LOCATION_ROOT, | 572 APP_MENU_LOCATION_SUBDIR_CHROME, |
| 573 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT | 573 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED}, |
| 574 }, { | 574 {creation_locations.applications_menu_location == |
| 575 creation_locations.applications_menu_location == | 575 APP_MENU_LOCATION_SUBDIR_CHROMEAPPS, |
| 576 APP_MENU_LOCATION_SUBDIR_CHROME, | 576 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR}, |
| 577 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR | 577 {// For Win7+, |in_quick_launch_bar| indicates that we are pinning to |
| 578 }, { | 578 // taskbar. This needs to be handled by callers. |
| 579 creation_locations.applications_menu_location == | 579 creation_locations.in_quick_launch_bar && |
| 580 APP_MENU_LOCATION_SUBDIR_CHROMEAPPS, | 580 base::win::CanPinShortcutToTaskbar(), |
| 581 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR | 581 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH}}; |
| 582 }, { | |
| 583 // For Win7+, |in_quick_launch_bar| indicates that we are pinning to | |
| 584 // taskbar. This needs to be handled by callers. | |
| 585 creation_locations.in_quick_launch_bar && | |
| 586 base::win::CanPinShortcutToTaskbar(), | |
| 587 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH | |
| 588 } | |
| 589 }; | |
| 590 | 582 |
| 591 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 583 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 592 // Populate shortcut_paths. | 584 // Populate shortcut_paths. |
| 593 for (int i = 0; i < arraysize(locations); ++i) { | 585 for (int i = 0; i < arraysize(locations); ++i) { |
| 594 if (locations[i].use_this_location) { | 586 if (locations[i].use_this_location) { |
| 595 base::FilePath path; | 587 base::FilePath path; |
| 596 if (!ShellUtil::GetShortcutPath(locations[i].location_id, | 588 if (!ShellUtil::GetShortcutPath(locations[i].location_id, |
| 597 dist, | 589 dist, |
| 598 ShellUtil::CURRENT_USER, | 590 ShellUtil::CURRENT_USER, |
| 599 &path)) { | 591 &path)) { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 614 | 606 |
| 615 } // namespace internals | 607 } // namespace internals |
| 616 | 608 |
| 617 void UpdateShortcutForTabContents(content::WebContents* web_contents) { | 609 void UpdateShortcutForTabContents(content::WebContents* web_contents) { |
| 618 // UpdateShortcutWorker will delete itself when it's done. | 610 // UpdateShortcutWorker will delete itself when it's done. |
| 619 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); | 611 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); |
| 620 worker->Run(); | 612 worker->Run(); |
| 621 } | 613 } |
| 622 | 614 |
| 623 } // namespace web_app | 615 } // namespace web_app |
| OLD | NEW |