diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 21:42:37 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 21:42:37 +0000 |
commit | 6f2e2824b8143ee4d6c8845b4c17e106acaa04f4 (patch) | |
tree | f8f816ceba805db9ed2f05f55f900bf474f4a8e4 /chrome/installer/util/master_preferences.cc | |
parent | 720ce12948a8289f76877927750d9c8f8878b4d1 (diff) | |
download | chromium_src-6f2e2824b8143ee4d6c8845b4c17e106acaa04f4.zip chromium_src-6f2e2824b8143ee4d6c8845b4c17e106acaa04f4.tar.gz chromium_src-6f2e2824b8143ee4d6c8845b4c17e106acaa04f4.tar.bz2 |
Use alternate icon for Chrome shortcuts if specified in master preferences.
This change depends on change 159539 that is currently under review and a new chrome2.ico that is yet to be added to the repository.
BUG=12701
TEST=Specify an alternate icon in --installerdata file and make sure that icon is used for shortcuts and it not changed later by updates.
Review URL: http://codereview.chromium.org/159618
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/master_preferences.cc')
-rw-r--r-- | chrome/installer/util/master_preferences.cc | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index f8c8018..92d57cb 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -10,31 +10,16 @@ #include "chrome/common/json_value_serializer.h" namespace { - const wchar_t* kDistroDict = L"distribution"; -DictionaryValue* GetPrefsFromFile(const FilePath& master_prefs_path) { - std::string json_data; - if (!file_util::ReadFileToString(master_prefs_path, &json_data)) - return NULL; - - JSONStringValueSerializer json(json_data); - scoped_ptr<Value> root(json.Deserialize(NULL)); - if (!root.get()) - return NULL; - - if (!root->IsType(Value::TYPE_DICTIONARY)) - return NULL; - - return static_cast<DictionaryValue*>(root.release()); -} } // namespace namespace installer_util { namespace master_preferences { const wchar_t kAltFirstRunBubble[] = L"oem_bubble"; const wchar_t kAltShortcutText[] = L"alternate_shortcut_text"; +const wchar_t kChromeShortcutIconIndex[] = L"chrome_shortcut_icon_index"; const wchar_t kCreateAllShortcuts[] = L"create_all_shortcuts"; const wchar_t kDistroImportBookmarksPref[] = L"import_bookmarks"; const wchar_t kDistroImportHistoryPref[] = L"import_history"; @@ -61,20 +46,17 @@ bool GetDistroBooleanPreference(const DictionaryValue* prefs, return value; } -bool GetDistributionPingDelay(const DictionaryValue* prefs, - int* ping_delay) { - if (!ping_delay) +bool GetDistroIntegerPreference(const DictionaryValue* prefs, + const std::wstring& name, + int* value) { + if (!value) return false; - // 90 seconds is the default that we want to use in case master preferences - // is missing or corrupt. - *ping_delay = 90; - DictionaryValue* distro = NULL; if (!prefs || !prefs->GetDictionary(kDistroDict, &distro) || !distro) return false; - if (!distro->GetInteger(master_preferences::kDistroPingDelay, ping_delay)) + if (!distro->GetInteger(name, value)) return false; return true; @@ -87,8 +69,19 @@ DictionaryValue* ParseDistributionPreferences( << master_prefs_path.value(); return NULL; } + std::string json_data; + if (!file_util::ReadFileToString(master_prefs_path, &json_data)) + return NULL; + JSONStringValueSerializer json(json_data); + scoped_ptr<Value> root(json.Deserialize(NULL)); - return GetPrefsFromFile(master_prefs_path); + if (!root.get()) + return NULL; + + if (!root->IsType(Value::TYPE_DICTIONARY)) + return NULL; + + return static_cast<DictionaryValue*>(root.release()); } std::vector<std::wstring> GetFirstRunTabs(const DictionaryValue* prefs) { |