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

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

Issue 7005019: Put SxS switches back into the rename command. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_frame_operations.h" 5 #include "chrome/installer/util/chrome_frame_operations.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/installer/util/browser_distribution.h" 10 #include "chrome/installer/util/browser_distribution.h"
(...skipping 19 matching lines...) Expand all
30 30
31 void ChromeFrameOperations::ReadOptions( 31 void ChromeFrameOperations::ReadOptions(
32 const MasterPreferences& prefs, 32 const MasterPreferences& prefs,
33 std::set<std::wstring>* options) const { 33 std::set<std::wstring>* options) const {
34 DCHECK(options); 34 DCHECK(options);
35 35
36 static const struct PrefToOption { 36 static const struct PrefToOption {
37 const char* pref_name; 37 const char* pref_name;
38 const wchar_t* option_name; 38 const wchar_t* option_name;
39 } map[] = { 39 } map[] = {
40 { master_preferences::kCeee, kOptionCeee },
41 { master_preferences::kChromeFrameReadyMode, kOptionReadyMode }, 40 { master_preferences::kChromeFrameReadyMode, kOptionReadyMode },
42 { master_preferences::kMultiInstall, kOptionMultiInstall } 41 { master_preferences::kMultiInstall, kOptionMultiInstall }
43 }; 42 };
44 43
45 bool pref_value; 44 bool pref_value;
46 45
47 for (const PrefToOption* scan = &map[0], *end = &map[arraysize(map)]; 46 for (const PrefToOption* scan = &map[0], *end = &map[arraysize(map)];
48 scan != end; ++scan) { 47 scan != end; ++scan) {
49 if (prefs.GetBool(scan->pref_name, &pref_value) && pref_value) 48 if (prefs.GetBool(scan->pref_name, &pref_value) && pref_value)
50 options->insert(scan->option_name); 49 options->insert(scan->option_name);
51 } 50 }
52 51
53 NormalizeOptions(options); 52 NormalizeOptions(options);
54 } 53 }
55 54
56 void ChromeFrameOperations::ReadOptions( 55 void ChromeFrameOperations::ReadOptions(
57 const CommandLine& uninstall_command, 56 const CommandLine& uninstall_command,
58 std::set<std::wstring>* options) const { 57 std::set<std::wstring>* options) const {
59 DCHECK(options); 58 DCHECK(options);
60 59
61 static const struct FlagToOption { 60 static const struct FlagToOption {
62 const char* flag_name; 61 const char* flag_name;
63 const wchar_t* option_name; 62 const wchar_t* option_name;
64 } map[] = { 63 } map[] = {
65 { switches::kCeee, kOptionCeee },
66 { switches::kChromeFrameReadyMode, kOptionReadyMode }, 64 { switches::kChromeFrameReadyMode, kOptionReadyMode },
67 { switches::kMultiInstall, kOptionMultiInstall } 65 { switches::kMultiInstall, kOptionMultiInstall }
68 }; 66 };
69 67
70 for (const FlagToOption* scan = &map[0], *end = &map[arraysize(map)]; 68 for (const FlagToOption* scan = &map[0], *end = &map[arraysize(map)];
71 scan != end; ++scan) { 69 scan != end; ++scan) {
72 if (uninstall_command.HasSwitch(scan->flag_name)) 70 if (uninstall_command.HasSwitch(scan->flag_name))
73 options->insert(scan->option_name); 71 options->insert(scan->option_name);
74 } 72 }
75 73
76 NormalizeOptions(options); 74 NormalizeOptions(options);
77 } 75 }
78 76
79 void ChromeFrameOperations::AddKeyFiles( 77 void ChromeFrameOperations::AddKeyFiles(
80 const std::set<std::wstring>& options, 78 const std::set<std::wstring>& options,
81 std::vector<FilePath>* key_files) const { 79 std::vector<FilePath>* key_files) const {
82 DCHECK(key_files); 80 DCHECK(key_files);
83 key_files->push_back(FilePath(installer::kChromeFrameDll)); 81 key_files->push_back(FilePath(installer::kChromeFrameDll));
84 key_files->push_back(FilePath(installer::kChromeFrameHelperExe)); 82 key_files->push_back(FilePath(installer::kChromeFrameHelperExe));
85 if (options.find(kOptionCeee) != options.end()) {
86 key_files->push_back(FilePath(installer::kCeeeIeDll));
87 key_files->push_back(FilePath(installer::kCeeeBrokerExe));
88 }
89 } 83 }
90 84
91 void ChromeFrameOperations::AddComDllList( 85 void ChromeFrameOperations::AddComDllList(
92 const std::set<std::wstring>& options, 86 const std::set<std::wstring>& options,
93 std::vector<FilePath>* com_dll_list) const { 87 std::vector<FilePath>* com_dll_list) const {
94 DCHECK(com_dll_list); 88 DCHECK(com_dll_list);
95 std::vector<FilePath> dll_list; 89 std::vector<FilePath> dll_list;
96 com_dll_list->push_back(FilePath(installer::kChromeFrameDll)); 90 com_dll_list->push_back(FilePath(installer::kChromeFrameDll));
97 if (options.find(kOptionCeee) != options.end()) {
98 com_dll_list->push_back(FilePath(installer::kCeeeInstallHelperDll));
99 com_dll_list->push_back(FilePath(installer::kCeeeIeDll));
100 }
101 } 91 }
102 92
103 void ChromeFrameOperations::AppendProductFlags( 93 void ChromeFrameOperations::AppendUninstallFlags(
104 const std::set<std::wstring>& options, 94 const std::set<std::wstring>& options,
105 CommandLine* uninstall_command) const { 95 CommandLine* cmd_line) const {
106 DCHECK(uninstall_command); 96 DCHECK(cmd_line);
107 uninstall_command->AppendSwitch(switches::kChromeFrame); 97 bool is_multi_install = options.find(kOptionMultiInstall) != options.end();
108 98
109 if (options.find(kOptionCeee) != options.end()) 99 // Add --multi-install if it isn't already there.
110 uninstall_command->AppendSwitch(switches::kCeee); 100 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall))
101 cmd_line->AppendSwitch(switches::kMultiInstall);
111 102
112 if (options.find(kOptionMultiInstall) != options.end()) { 103 // --chrome-frame is always needed.
113 if (!uninstall_command->HasSwitch(switches::kMultiInstall)) 104 cmd_line->AppendSwitch(switches::kChromeFrame);
114 uninstall_command->AppendSwitch(switches::kMultiInstall);
115 105
116 // ready-mode is only supported in multi-installs of Chrome Frame. 106 // ready-mode is only supported in multi-installs of Chrome Frame.
117 if (options.find(kOptionReadyMode) != options.end()) 107 if (is_multi_install && options.find(kOptionReadyMode) != options.end())
118 uninstall_command->AppendSwitch(switches::kChromeFrameReadyMode); 108 cmd_line->AppendSwitch(switches::kChromeFrameReadyMode);
119 } 109 }
110
111 void ChromeFrameOperations::AppendRenameFlags(
112 const std::set<std::wstring>& options,
113 CommandLine* cmd_line) const {
114 DCHECK(cmd_line);
115 bool is_multi_install = options.find(kOptionMultiInstall) != options.end();
116
117 // Add --multi-install if it isn't already there.
118 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall))
119 cmd_line->AppendSwitch(switches::kMultiInstall);
120
121 // --chrome-frame is needed for single installs.
122 if (!is_multi_install)
123 cmd_line->AppendSwitch(switches::kChromeFrame);
120 } 124 }
121 125
122 bool ChromeFrameOperations::SetChannelFlags( 126 bool ChromeFrameOperations::SetChannelFlags(
123 const std::set<std::wstring>& options, 127 const std::set<std::wstring>& options,
124 bool set, 128 bool set,
125 ChannelInfo* channel_info) const { 129 ChannelInfo* channel_info) const {
126 #if defined(GOOGLE_CHROME_BUILD) 130 #if defined(GOOGLE_CHROME_BUILD)
127 DCHECK(channel_info); 131 DCHECK(channel_info);
128 bool modified = channel_info->SetChromeFrame(set); 132 bool modified = channel_info->SetChromeFrame(set);
129 133
130 // Always remove the options if we're called to remove flags or if the 134 // Always remove the options if we're called to remove flags or if the
131 // corresponding option isn't set. 135 // corresponding option isn't set.
132 modified |= channel_info->SetCeee(
133 set && options.find(kOptionCeee) != options.end());
134
135 modified |= channel_info->SetReadyMode( 136 modified |= channel_info->SetReadyMode(
136 set && options.find(kOptionReadyMode) != options.end()); 137 set && options.find(kOptionReadyMode) != options.end());
137 138
138 return modified; 139 return modified;
139 #else 140 #else
140 return false; 141 return false;
141 #endif 142 #endif
142 } 143 }
143 144
144 bool ChromeFrameOperations::ShouldCreateUninstallEntry( 145 bool ChromeFrameOperations::ShouldCreateUninstallEntry(
145 const std::set<std::wstring>& options) const { 146 const std::set<std::wstring>& options) const {
146 return options.find(kOptionReadyMode) == options.end(); 147 return options.find(kOptionReadyMode) == options.end();
147 } 148 }
148 149
149 } // namespace installer 150 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/chrome_frame_operations.h ('k') | chrome/installer/util/installation_validator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698