| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/installer/util/chrome_browser_operations.h" | 5 #include "chrome/installer/util/chrome_browser_operations.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 bool ChromeBrowserOperations::ShouldCreateUninstallEntry( | 101 bool ChromeBrowserOperations::ShouldCreateUninstallEntry( |
| 102 const std::set<base::string16>& options) const { | 102 const std::set<base::string16>& options) const { |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 // Modifies a ShortcutProperties object by adding default values to | 106 // Modifies a ShortcutProperties object by adding default values to |
| 107 // uninitialized members. Tries to assign: | 107 // uninitialized members. Tries to assign: |
| 108 // - target: |chrome_exe|. | 108 // - target: |chrome_exe|. |
| 109 // - icon: from |chrome_exe|. | 109 // - icon: from |chrome_exe|. |
| 110 // - icon_index: |dist|'s icon index (possibly overridden by | 110 // - icon_index: |dist|'s icon index |
| 111 // khromeShortcutIconIndex in master_preferences) | |
| 112 // - app_id: the browser model id for the current install. | 111 // - app_id: the browser model id for the current install. |
| 113 // - description: |dist|'s description. | 112 // - description: |dist|'s description. |
| 114 void ChromeBrowserOperations::AddDefaultShortcutProperties( | 113 void ChromeBrowserOperations::AddDefaultShortcutProperties( |
| 115 BrowserDistribution* dist, | 114 BrowserDistribution* dist, |
| 116 const base::FilePath& target_exe, | 115 const base::FilePath& target_exe, |
| 117 ShellUtil::ShortcutProperties* properties) const { | 116 ShellUtil::ShortcutProperties* properties) const { |
| 118 if (!properties->has_target()) | 117 if (!properties->has_target()) |
| 119 properties->set_target(target_exe); | 118 properties->set_target(target_exe); |
| 120 | 119 |
| 121 if (!properties->has_icon()) { | 120 if (!properties->has_icon()) { |
| 122 int icon_index = | 121 properties->set_icon( |
| 123 dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME); | 122 target_exe, dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); |
| 124 base::FilePath prefs_path(target_exe.DirName().AppendASCII( | |
| 125 installer::kDefaultMasterPrefs)); | |
| 126 if (base::PathExists(prefs_path)) { | |
| 127 installer::MasterPreferences prefs(prefs_path); | |
| 128 prefs.GetInt(installer::master_preferences::kChromeShortcutIconIndex, | |
| 129 &icon_index); | |
| 130 } | |
| 131 properties->set_icon(target_exe, icon_index); | |
| 132 } | 123 } |
| 133 | 124 |
| 134 if (!properties->has_app_id()) { | 125 if (!properties->has_app_id()) { |
| 135 bool is_per_user_install = InstallUtil::IsPerUserInstall(target_exe); | 126 properties->set_app_id(ShellUtil::GetBrowserModelId( |
| 136 properties->set_app_id( | 127 dist, InstallUtil::IsPerUserInstall(target_exe))); |
| 137 ShellUtil::GetBrowserModelId(dist, is_per_user_install)); | |
| 138 } | 128 } |
| 139 | 129 |
| 140 if (!properties->has_description()) | 130 if (!properties->has_description()) |
| 141 properties->set_description(dist->GetAppDescription()); | 131 properties->set_description(dist->GetAppDescription()); |
| 142 } | 132 } |
| 143 | 133 |
| 144 void ChromeBrowserOperations::LaunchUserExperiment( | 134 void ChromeBrowserOperations::LaunchUserExperiment( |
| 145 const base::FilePath& setup_path, | 135 const base::FilePath& setup_path, |
| 146 const std::set<base::string16>& options, | 136 const std::set<base::string16>& options, |
| 147 InstallStatus status, | 137 InstallStatus status, |
| 148 bool system_level) const { | 138 bool system_level) const { |
| 149 base::CommandLine base_command(setup_path); | 139 base::CommandLine base_command(setup_path); |
| 150 AppendProductFlags(options, &base_command); | 140 AppendProductFlags(options, &base_command); |
| 151 installer::LaunchBrowserUserExperiment(base_command, status, system_level); | 141 installer::LaunchBrowserUserExperiment(base_command, status, system_level); |
| 152 } | 142 } |
| 153 | 143 |
| 154 } // namespace installer | 144 } // namespace installer |
| OLD | NEW |