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

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

Issue 10665002: Implement installation of the Chrome App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: A basic working app host installer/uninstaller. Created 8 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/installer/util/chrome_app_host_operations.h"
6
7 #include "base/command_line.h"
8 #include "base/file_path.h"
9 #include "base/logging.h"
10 #include "chrome/installer/util/browser_distribution.h"
11 #include "chrome/installer/util/channel_info.h"
12 #include "chrome/installer/util/helper.h"
13 #include "chrome/installer/util/master_preferences.h"
14 #include "chrome/installer/util/master_preferences_constants.h"
15 #include "chrome/installer/util/util_constants.h"
16
17 namespace installer {
18
19 void ChromeAppHostOperations::ReadOptions(
20 const MasterPreferences& prefs,
21 std::set<std::wstring>* options) const {
22 DCHECK(options);
23
24 static const struct PrefToOption {
25 const char* pref_name;
26 const wchar_t* option_name;
27 } map[] = {
28 { master_preferences::kMultiInstall, kOptionMultiInstall }
29 };
30
31 bool pref_value;
32
33 for (const PrefToOption* scan = &map[0], *end = &map[arraysize(map)];
34 scan != end; ++scan) {
35 if (prefs.GetBool(scan->pref_name, &pref_value) && pref_value)
36 options->insert(scan->option_name);
37 }
38 }
39
40 void ChromeAppHostOperations::ReadOptions(
41 const CommandLine& uninstall_command,
42 std::set<std::wstring>* options) const {
43 DCHECK(options);
44
45 static const struct FlagToOption {
46 const char* flag_name;
47 const wchar_t* option_name;
48 } map[] = {
49 { switches::kMultiInstall, kOptionMultiInstall }
50 };
51
52 for (const FlagToOption* scan = &map[0], *end = &map[arraysize(map)];
53 scan != end; ++scan) {
54 if (uninstall_command.HasSwitch(scan->flag_name))
55 options->insert(scan->option_name);
56 }
57 }
58
59 void ChromeAppHostOperations::AddKeyFiles(
60 const std::set<std::wstring>& options,
61 std::vector<FilePath>* key_files) const {
62 // TODO(erikwright): I guess this isn't needed?
grt (UTC plus 2) 2012/07/12 18:37:10 if it's the case now that the binaries' product is
erikwright (departed) 2012/07/16 20:13:11 Done.
63 DCHECK(key_files);
64 key_files->push_back(FilePath(installer::kChromeDll));
65 }
66
67 void ChromeAppHostOperations::AddComDllList(
68 const std::set<std::wstring>& options,
69 std::vector<FilePath>* com_dll_list) const {
70 }
71
72 void ChromeAppHostOperations::AppendProductFlags(
73 const std::set<std::wstring>& options,
74 CommandLine* cmd_line) const {
75 DCHECK(cmd_line);
76 bool is_multi_install = options.find(kOptionMultiInstall) != options.end();
77
78 // Non-multi-install not supported for the app host.
79 DCHECK(is_multi_install);
80
81 // Add --multi-install if it isn't already there.
82 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall))
83 cmd_line->AppendSwitch(switches::kMultiInstall);
84
85 // --app-host is always needed.
86 cmd_line->AppendSwitch(switches::kChromeAppHost);
87 }
88
89 void ChromeAppHostOperations::AppendRenameFlags(
90 const std::set<std::wstring>& options,
91 CommandLine* cmd_line) const {
92 DCHECK(cmd_line);
93 bool is_multi_install = options.find(kOptionMultiInstall) != options.end();
94
95 // Non-multi-install not supported for the app host.
96 DCHECK(is_multi_install);
97
98 // Add --multi-install if it isn't already there.
99 if (is_multi_install && !cmd_line->HasSwitch(switches::kMultiInstall))
100 cmd_line->AppendSwitch(switches::kMultiInstall);
101 }
102
103 bool ChromeAppHostOperations::SetChannelFlags(
104 const std::set<std::wstring>& options,
105 bool set,
106 ChannelInfo* channel_info) const {
107 #if defined(GOOGLE_CHROME_BUILD)
108 DCHECK(channel_info);
109 bool modified = channel_info->SetAppHost(set);
110
111 return modified;
112 #else
113 return false;
114 #endif
115 }
116
117 bool ChromeAppHostOperations::ShouldCreateUninstallEntry(
118 const std::set<std::wstring>& options) const {
119 return false;
120 }
121
122 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698