| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 10 #include <windows.h> |
| 11 #include <shellapi.h> | 11 #include <shellapi.h> |
| 12 #include <shlobj.h> | 12 #include <shlobj.h> |
| 13 | 13 |
| 14 #include "chrome/installer/util/shell_util.h" | 14 #include "chrome/installer/util/shell_util.h" |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 21 #include "base/registry.h" | 21 #include "base/registry.h" |
| 22 #include "base/scoped_ptr.h" | 22 #include "base/scoped_ptr.h" |
| 23 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 24 #include "base/win_util.h" | 24 #include "base/win_util.h" |
| 25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/installer/util/browser_distribution.h" | 27 #include "chrome/installer/util/browser_distribution.h" |
| 28 #include "chrome/installer/util/create_reg_key_work_item.h" | 28 #include "chrome/installer/util/create_reg_key_work_item.h" |
| 29 #include "chrome/installer/util/install_util.h" | 29 #include "chrome/installer/util/install_util.h" |
| 30 #include "chrome/installer/util/master_preferences.h" |
| 30 #include "chrome/installer/util/l10n_string_util.h" | 31 #include "chrome/installer/util/l10n_string_util.h" |
| 31 #include "chrome/installer/util/set_reg_value_work_item.h" | 32 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 32 #include "chrome/installer/util/util_constants.h" | 33 #include "chrome/installer/util/util_constants.h" |
| 33 #include "chrome/installer/util/work_item.h" | 34 #include "chrome/installer/util/work_item.h" |
| 34 | 35 |
| 35 #include "installer_util_strings.h" | 36 #include "installer_util_strings.h" |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 // This class represents a single registry entry. The objective is to | 40 // This class represents a single registry entry. The objective is to |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 685 } |
| 685 | 686 |
| 686 return ret; | 687 return ret; |
| 687 } | 688 } |
| 688 | 689 |
| 689 bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe, | 690 bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe, |
| 690 const std::wstring& shortcut, | 691 const std::wstring& shortcut, |
| 691 const std::wstring& description, | 692 const std::wstring& description, |
| 692 bool create_new) { | 693 bool create_new) { |
| 693 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe); | 694 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe); |
| 695 |
| 694 if (create_new) { | 696 if (create_new) { |
| 697 FilePath prefs_path(chrome_path); |
| 698 prefs_path = prefs_path.Append(installer_util::kDefaultMasterPrefs); |
| 699 scoped_ptr<DictionaryValue> prefs( |
| 700 installer_util::ParseDistributionPreferences(prefs_path)); |
| 701 int icon_index = 0; |
| 702 installer_util::GetDistroIntegerPreference(prefs.get(), |
| 703 installer_util::master_preferences::kChromeShortcutIconIndex, |
| 704 &icon_index); |
| 695 return file_util::CreateShortcutLink(chrome_exe.c_str(), // target | 705 return file_util::CreateShortcutLink(chrome_exe.c_str(), // target |
| 696 shortcut.c_str(), // shortcut | 706 shortcut.c_str(), // shortcut |
| 697 chrome_path.c_str(), // working dir | 707 chrome_path.c_str(), // working dir |
| 698 NULL, // arguments | 708 NULL, // arguments |
| 699 description.c_str(), // description | 709 description.c_str(), // description |
| 700 chrome_exe.c_str(), // icon file | 710 chrome_exe.c_str(), // icon file |
| 701 0); // icon index | 711 icon_index); // icon index |
| 702 } else { | 712 } else { |
| 703 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target | 713 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target |
| 704 shortcut.c_str(), // shortcut | 714 shortcut.c_str(), // shortcut |
| 705 chrome_path.c_str(), // working dir | 715 chrome_path.c_str(), // working dir |
| 706 NULL, // arguments | 716 NULL, // arguments |
| 707 description.c_str(), // description | 717 description.c_str(), // description |
| 708 chrome_exe.c_str(), // icon file | 718 chrome_exe.c_str(), // icon file |
| 709 0); // icon index | 719 0); // icon index |
| 710 } | 720 } |
| 711 } | 721 } |
| OLD | NEW |