OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 778 } |
779 | 779 |
780 return ret; | 780 return ret; |
781 } | 781 } |
782 | 782 |
783 bool ShellUtil::UpdateChromeShortcut(BrowserDistribution* dist, | 783 bool ShellUtil::UpdateChromeShortcut(BrowserDistribution* dist, |
784 const std::wstring& chrome_exe, | 784 const std::wstring& chrome_exe, |
785 const std::wstring& shortcut, | 785 const std::wstring& shortcut, |
786 const std::wstring& description, | 786 const std::wstring& description, |
787 bool create_new) { | 787 bool create_new) { |
788 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe); | 788 std::wstring chrome_path = FilePath(chrome_exe).DirName().value(); |
789 | 789 |
790 FilePath prefs_path(chrome_path); | 790 FilePath prefs_path(chrome_path); |
791 prefs_path = prefs_path.AppendASCII(installer::kDefaultMasterPrefs); | 791 prefs_path = prefs_path.AppendASCII(installer::kDefaultMasterPrefs); |
792 installer::MasterPreferences prefs(prefs_path); | 792 installer::MasterPreferences prefs(prefs_path); |
793 int icon_index = dist->GetIconIndex(); | 793 int icon_index = dist->GetIconIndex(); |
794 prefs.GetInt(installer::master_preferences::kChromeShortcutIconIndex, | 794 prefs.GetInt(installer::master_preferences::kChromeShortcutIconIndex, |
795 &icon_index); | 795 &icon_index); |
796 if (create_new) { | 796 if (create_new) { |
797 return file_util::CreateShortcutLink( | 797 return file_util::CreateShortcutLink( |
798 chrome_exe.c_str(), // target | 798 chrome_exe.c_str(), // target |
799 shortcut.c_str(), // shortcut | 799 shortcut.c_str(), // shortcut |
800 chrome_path.c_str(), // working dir | 800 chrome_path.c_str(), // working dir |
801 NULL, // arguments | 801 NULL, // arguments |
802 description.c_str(), // description | 802 description.c_str(), // description |
803 chrome_exe.c_str(), // icon file | 803 chrome_exe.c_str(), // icon file |
804 icon_index, // icon index | 804 icon_index, // icon index |
805 dist->GetBrowserAppId().c_str()); // app id | 805 dist->GetBrowserAppId().c_str()); // app id |
806 } else { | 806 } else { |
807 return file_util::UpdateShortcutLink( | 807 return file_util::UpdateShortcutLink( |
808 chrome_exe.c_str(), // target | 808 chrome_exe.c_str(), // target |
809 shortcut.c_str(), // shortcut | 809 shortcut.c_str(), // shortcut |
810 chrome_path.c_str(), // working dir | 810 chrome_path.c_str(), // working dir |
811 NULL, // arguments | 811 NULL, // arguments |
812 description.c_str(), // description | 812 description.c_str(), // description |
813 chrome_exe.c_str(), // icon file | 813 chrome_exe.c_str(), // icon file |
814 icon_index, // icon index | 814 icon_index, // icon index |
815 dist->GetBrowserAppId().c_str()); // app id | 815 dist->GetBrowserAppId().c_str()); // app id |
816 } | 816 } |
817 } | 817 } |
OLD | NEW |