Chromium Code Reviews

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

Issue 4342001: Refactoring the master_preferences functions.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « chrome/installer/util/master_preferences_unittest.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) 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 12 matching lines...)
23 #include "base/string_util.h" 23 #include "base/string_util.h"
24 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
25 #include "base/values.h" 25 #include "base/values.h"
26 #include "base/win/registry.h" 26 #include "base/win/registry.h"
27 #include "base/win/windows_version.h" 27 #include "base/win/windows_version.h"
28 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/installer/util/browser_distribution.h" 30 #include "chrome/installer/util/browser_distribution.h"
31 #include "chrome/installer/util/install_util.h" 31 #include "chrome/installer/util/install_util.h"
32 #include "chrome/installer/util/master_preferences.h" 32 #include "chrome/installer/util/master_preferences.h"
33 #include "chrome/installer/util/master_preferences_constants.h"
33 34
34 #include "installer_util_strings.h" 35 #include "installer_util_strings.h"
35 36
36 using base::win::RegKey; 37 using base::win::RegKey;
37 38
38 namespace { 39 namespace {
39 40
40 // This class represents a single registry entry. The objective is to 41 // This class represents a single registry entry. The objective is to
41 // encapsulate all the registry entries required for registering Chrome at one 42 // encapsulate all the registry entries required for registering Chrome at one
42 // place. This class can not be instantiated outside the class and the objects 43 // place. This class can not be instantiated outside the class and the objects
(...skipping 732 matching lines...)
775 776
776 bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe, 777 bool ShellUtil::UpdateChromeShortcut(const std::wstring& chrome_exe,
777 const std::wstring& shortcut, 778 const std::wstring& shortcut,
778 const std::wstring& description, 779 const std::wstring& description,
779 bool create_new) { 780 bool create_new) {
780 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 781 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
781 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe); 782 std::wstring chrome_path = file_util::GetDirectoryFromPath(chrome_exe);
782 783
783 FilePath prefs_path(chrome_path); 784 FilePath prefs_path(chrome_path);
784 prefs_path = prefs_path.AppendASCII(installer_util::kDefaultMasterPrefs); 785 prefs_path = prefs_path.AppendASCII(installer_util::kDefaultMasterPrefs);
785 scoped_ptr<DictionaryValue> prefs( 786 installer_util::MasterPreferences prefs(prefs_path);
786 installer_util::ParseDistributionPreferences(prefs_path));
787 int icon_index = dist->GetIconIndex(); 787 int icon_index = dist->GetIconIndex();
788 installer_util::GetDistroIntegerPreference(prefs.get(), 788 prefs.GetInt(installer_util::master_preferences::kChromeShortcutIconIndex,
789 installer_util::master_preferences::kChromeShortcutIconIndex, 789 &icon_index);
790 &icon_index);
791 if (create_new) { 790 if (create_new) {
792 return file_util::CreateShortcutLink( 791 return file_util::CreateShortcutLink(
793 chrome_exe.c_str(), // target 792 chrome_exe.c_str(), // target
794 shortcut.c_str(), // shortcut 793 shortcut.c_str(), // shortcut
795 chrome_path.c_str(), // working dir 794 chrome_path.c_str(), // working dir
796 NULL, // arguments 795 NULL, // arguments
797 description.c_str(), // description 796 description.c_str(), // description
798 chrome_exe.c_str(), // icon file 797 chrome_exe.c_str(), // icon file
799 icon_index, // icon index 798 icon_index, // icon index
800 dist->GetBrowserAppId().c_str()); // app id 799 dist->GetBrowserAppId().c_str()); // app id
801 } else { 800 } else {
802 return file_util::UpdateShortcutLink( 801 return file_util::UpdateShortcutLink(
803 chrome_exe.c_str(), // target 802 chrome_exe.c_str(), // target
804 shortcut.c_str(), // shortcut 803 shortcut.c_str(), // shortcut
805 chrome_path.c_str(), // working dir 804 chrome_path.c_str(), // working dir
806 NULL, // arguments 805 NULL, // arguments
807 description.c_str(), // description 806 description.c_str(), // description
808 chrome_exe.c_str(), // icon file 807 chrome_exe.c_str(), // icon file
809 icon_index, // icon index 808 icon_index, // icon index
810 dist->GetBrowserAppId().c_str()); // app id 809 dist->GetBrowserAppId().c_str()); // app id
811 } 810 }
812 } 811 }
OLDNEW
« no previous file with comments | « chrome/installer/util/master_preferences_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine