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

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

Issue 12321061: Pulling user experiment code from BrowserDistribution to a new class. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: *Only* making ProductOperation to use string16 instead of std::wstring; wrapping changes. Created 7 years, 9 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
OLDNEW
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_app_host_operations.h" 5 #include "chrome/installer/util/chrome_app_host_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/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/installer/util/browser_distribution.h" 11 #include "chrome/installer/util/browser_distribution.h"
12 #include "chrome/installer/util/channel_info.h" 12 #include "chrome/installer/util/channel_info.h"
13 #include "chrome/installer/util/helper.h" 13 #include "chrome/installer/util/helper.h"
14 #include "chrome/installer/util/master_preferences.h" 14 #include "chrome/installer/util/master_preferences.h"
15 #include "chrome/installer/util/master_preferences_constants.h" 15 #include "chrome/installer/util/master_preferences_constants.h"
16 #include "chrome/installer/util/shell_util.h" 16 #include "chrome/installer/util/shell_util.h"
17 #include "chrome/installer/util/util_constants.h" 17 #include "chrome/installer/util/util_constants.h"
18 18
19 namespace installer { 19 namespace installer {
20 20
21 void ChromeAppHostOperations::ReadOptions( 21 void ChromeAppHostOperations::ReadOptions(const MasterPreferences& prefs,
22 const MasterPreferences& prefs, 22 std::set<string16>* options) const {
23 std::set<std::wstring>* options) const {
24 DCHECK(options); 23 DCHECK(options);
25 24
26 bool pref_value; 25 bool pref_value;
27 if (prefs.GetBool(master_preferences::kMultiInstall, &pref_value) && 26 if (prefs.GetBool(master_preferences::kMultiInstall, &pref_value) &&
28 pref_value) { 27 pref_value) {
29 options->insert(kOptionMultiInstall); 28 options->insert(kOptionMultiInstall);
30 } 29 }
31 } 30 }
32 31
33 void ChromeAppHostOperations::ReadOptions( 32 void ChromeAppHostOperations::ReadOptions(const CommandLine& uninstall_command,
34 const CommandLine& uninstall_command, 33 std::set<string16>* options) const {
35 std::set<std::wstring>* options) const {
36 DCHECK(options); 34 DCHECK(options);
37 35
38 if (uninstall_command.HasSwitch(switches::kMultiInstall)) 36 if (uninstall_command.HasSwitch(switches::kMultiInstall))
39 options->insert(kOptionMultiInstall); 37 options->insert(kOptionMultiInstall);
40 } 38 }
41 39
42 void ChromeAppHostOperations::AddKeyFiles( 40 void ChromeAppHostOperations::AddKeyFiles(
43 const std::set<std::wstring>& options, 41 const std::set<string16>& options,
44 std::vector<base::FilePath>* key_files) const { 42 std::vector<base::FilePath>* key_files) const {
45 } 43 }
46 44
47 void ChromeAppHostOperations::AddComDllList( 45 void ChromeAppHostOperations::AddComDllList(
48 const std::set<std::wstring>& options, 46 const std::set<string16>& options,
49 std::vector<base::FilePath>* com_dll_list) const { 47 std::vector<base::FilePath>* com_dll_list) const {
50 } 48 }
51 49
52 void ChromeAppHostOperations::AppendProductFlags( 50 void ChromeAppHostOperations::AppendProductFlags(
53 const std::set<std::wstring>& options, 51 const std::set<string16>& options,
54 CommandLine* cmd_line) const { 52 CommandLine* cmd_line) const {
55 DCHECK(cmd_line); 53 DCHECK(cmd_line);
56 bool is_multi_install = options.find(kOptionMultiInstall) != options.end(); 54 bool is_multi_install = options.find(kOptionMultiInstall) != options.end();
57 55
58 // Non-multi-install not supported for the app host. 56 // Non-multi-install not supported for the app host.
59 DCHECK(is_multi_install); 57 DCHECK(is_multi_install);
60 58
61 // Add --multi-install if it isn't already there. 59 // Add --multi-install if it isn't already there.
62 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall)) 60 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall))
63 cmd_line->AppendSwitch(switches::kMultiInstall); 61 cmd_line->AppendSwitch(switches::kMultiInstall);
64 62
65 // Add --app-launcher. 63 // Add --app-launcher.
66 cmd_line->AppendSwitch(switches::kChromeAppLauncher); 64 cmd_line->AppendSwitch(switches::kChromeAppLauncher);
67 } 65 }
68 66
69 void ChromeAppHostOperations::AppendRenameFlags( 67 void ChromeAppHostOperations::AppendRenameFlags(
70 const std::set<std::wstring>& options, 68 const std::set<string16>& options,
71 CommandLine* cmd_line) const { 69 CommandLine* cmd_line) const {
72 DCHECK(cmd_line); 70 DCHECK(cmd_line);
73 bool is_multi_install = options.find(kOptionMultiInstall) != options.end(); 71 bool is_multi_install = options.find(kOptionMultiInstall) != options.end();
74 72
75 // Non-multi-install not supported for the app host. 73 // Non-multi-install not supported for the app host.
76 DCHECK(is_multi_install); 74 DCHECK(is_multi_install);
77 75
78 // Add --multi-install if it isn't already there. 76 // Add --multi-install if it isn't already there.
79 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall)) 77 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall))
80 cmd_line->AppendSwitch(switches::kMultiInstall); 78 cmd_line->AppendSwitch(switches::kMultiInstall);
81 } 79 }
82 80
83 bool ChromeAppHostOperations::SetChannelFlags( 81 bool ChromeAppHostOperations::SetChannelFlags(const std::set<string16>& options,
84 const std::set<std::wstring>& options, 82 bool set,
85 bool set, 83 ChannelInfo* channel_info) const {
86 ChannelInfo* channel_info) const {
87 #if defined(GOOGLE_CHROME_BUILD) 84 #if defined(GOOGLE_CHROME_BUILD)
88 DCHECK(channel_info); 85 DCHECK(channel_info);
89 return channel_info->SetAppLauncher(set); 86 return channel_info->SetAppLauncher(set);
90 #else 87 #else
91 return false; 88 return false;
92 #endif 89 #endif
93 } 90 }
94 91
95 bool ChromeAppHostOperations::ShouldCreateUninstallEntry( 92 bool ChromeAppHostOperations::ShouldCreateUninstallEntry(
96 const std::set<std::wstring>& options) const { 93 const std::set<string16>& options) const {
97 return true; 94 return true;
98 } 95 }
99 96
100 void ChromeAppHostOperations::AddDefaultShortcutProperties( 97 void ChromeAppHostOperations::AddDefaultShortcutProperties(
101 BrowserDistribution* dist, 98 BrowserDistribution* dist,
102 const base::FilePath& target_exe, 99 const base::FilePath& target_exe,
103 ShellUtil::ShortcutProperties* properties) const { 100 ShellUtil::ShortcutProperties* properties) const {
104 if (!properties->has_target()) 101 if (!properties->has_target())
105 properties->set_target(target_exe); 102 properties->set_target(target_exe);
106 103
107 if (!properties->has_arguments()) { 104 if (!properties->has_arguments()) {
108 CommandLine app_host_args(CommandLine::NO_PROGRAM); 105 CommandLine app_host_args(CommandLine::NO_PROGRAM);
109 app_host_args.AppendSwitch(::switches::kShowAppList); 106 app_host_args.AppendSwitch(::switches::kShowAppList);
110 properties->set_arguments(app_host_args.GetCommandLineString()); 107 properties->set_arguments(app_host_args.GetCommandLineString());
111 } 108 }
112 109
113 if (!properties->has_icon()) 110 if (!properties->has_icon())
114 properties->set_icon(target_exe, dist->GetIconIndex()); 111 properties->set_icon(target_exe, dist->GetIconIndex());
115 112
116 if (!properties->has_app_id()) { 113 if (!properties->has_app_id()) {
117 std::vector<string16> components; 114 std::vector<string16> components;
118 components.push_back(dist->GetBaseAppId()); 115 components.push_back(dist->GetBaseAppId());
119 properties->set_app_id(ShellUtil::BuildAppModelId(components)); 116 properties->set_app_id(ShellUtil::BuildAppModelId(components));
120 } 117 }
121 } 118 }
122 119
120 void ChromeAppHostOperations::LaunchUserExperiment(
121 const base::FilePath& setup_path,
122 const std::set<string16>& options,
123 InstallStatus status,
124 bool system_level) const {
125 // No experiments yet. If adding some in the future, need to have
126 // ChromeAppHostDistribution::HasUserExperiments() return true.
127 NOTREACHED();
128 }
129
123 } // namespace installer 130 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698