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

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

Issue 159618: Use alternate icon for Chrome shortcuts if specified in master preferences. (Closed)
Patch Set: fix merge errors Created 11 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
« no previous file with comments | « chrome/installer/util/master_preferences.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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"
11 11
12 #include <windows.h> 12 #include <windows.h>
13 #include <shlobj.h> 13 #include <shlobj.h>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/registry.h" 19 #include "base/registry.h"
20 #include "base/scoped_ptr.h" 20 #include "base/scoped_ptr.h"
21 #include "base/stl_util-inl.h" 21 #include "base/stl_util-inl.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "base/win_util.h" 23 #include "base/win_util.h"
24 #include "chrome/common/chrome_constants.h" 24 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/installer/util/browser_distribution.h" 26 #include "chrome/installer/util/browser_distribution.h"
27 #include "chrome/installer/util/install_util.h" 27 #include "chrome/installer/util/install_util.h"
28 #include "chrome/installer/util/master_preferences.h"
28 29
29 #include "installer_util_strings.h" 30 #include "installer_util_strings.h"
30 31
31 namespace { 32 namespace {
32 33
33 // This class represents a single registry entry. The objective is to 34 // This class represents a single registry entry. The objective is to
34 // encapsulate all the registry entries required for registering Chrome at one 35 // encapsulate all the registry entries required for registering Chrome at one
35 // place. This class can not be instantiated outside the class and the objects 36 // place. This class can not be instantiated outside the class and the objects
36 // of this class type can be obtained only by calling a static method of this 37 // of this class type can be obtained only by calling a static method of this
37 // class. 38 // class.
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 762 }
762 763
763 return ret; 764 return ret;
764 } 765 }
765 766
766 bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe, 767 bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe,
767 const std::wstring& shortcut, 768 const std::wstring& shortcut,
768 const std::wstring& description, 769 const std::wstring& description,
769 bool create_new) { 770 bool create_new) {
770 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe); 771 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe);
772
771 if (create_new) { 773 if (create_new) {
774 FilePath prefs_path(chrome_path);
775 prefs_path = prefs_path.Append(installer_util::kDefaultMasterPrefs);
776 scoped_ptr<DictionaryValue> prefs(
777 installer_util::ParseDistributionPreferences(prefs_path));
778 int icon_index = 0;
779 installer_util::GetDistroIntegerPreference(prefs.get(),
780 installer_util::master_preferences::kChromeShortcutIconIndex,
781 &icon_index);
772 return file_util::CreateShortcutLink(chrome_exe.c_str(), // target 782 return file_util::CreateShortcutLink(chrome_exe.c_str(), // target
773 shortcut.c_str(), // shortcut 783 shortcut.c_str(), // shortcut
774 chrome_path.c_str(), // working dir 784 chrome_path.c_str(), // working dir
775 NULL, // arguments 785 NULL, // arguments
776 description.c_str(), // description 786 description.c_str(), // description
777 chrome_exe.c_str(), // icon file 787 chrome_exe.c_str(), // icon file
778 0); // icon index 788 icon_index); // icon index
779 } else { 789 } else {
780 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target 790 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target
781 shortcut.c_str(), // shortcut 791 shortcut.c_str(), // shortcut
782 chrome_path.c_str(), // working dir 792 chrome_path.c_str(), // working dir
783 NULL, // arguments 793 NULL, // arguments
784 description.c_str(), // description 794 description.c_str(), // description
785 chrome_exe.c_str(), // icon file 795 chrome_exe.c_str(), // icon file
786 0); // icon index 796 0); // icon index
787 } 797 }
788 } 798 }
OLDNEW
« no previous file with comments | « chrome/installer/util/master_preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698