OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Utilities related to installation of the CEEE. | 5 // Utilities related to installation of the CEEE. |
6 | 6 |
7 #include "ceee/common/install_utils.h" | 7 #include "ceee/common/install_utils.h" |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "chrome/installer/util/util_constants.h" | 14 #include "chrome/installer/util/util_constants.h" |
15 | 15 |
16 namespace installer_util { | 16 namespace installer { |
17 namespace switches { | 17 namespace switches { |
18 // TODO(joi@chromium.org) Move to chrome/installer/util_constants.h | 18 // TODO(joi@chromium.org) Move to chrome/installer/util_constants.h |
19 // when we refactor this logic to be in the installer rather than | 19 // when we refactor this logic to be in the installer rather than |
20 // on the registration entrypoints. | 20 // on the registration entrypoints. |
21 const char kEnableCeee[] = "enable-ceee"; | 21 const char kEnableCeee[] = "enable-ceee"; |
22 const char kEnableFfCeee[] = "enable-ff-ceee"; | 22 const char kEnableFfCeee[] = "enable-ff-ceee"; |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 namespace ceee_install_utils { | 26 namespace ceee_install_utils { |
27 | 27 |
28 bool ShouldRegisterImpl(bool check_firefox) { | 28 bool ShouldRegisterImpl(bool check_firefox) { |
29 // First check if it's a developer running us explicitly. | 29 // First check if it's a developer running us explicitly. |
30 FilePath exe_path; | 30 FilePath exe_path; |
31 if (PathService::Get(base::FILE_EXE, &exe_path)) { | 31 if (PathService::Get(base::FILE_EXE, &exe_path)) { |
32 if (exe_path.BaseName() == FilePath(L"regsvr32.exe")) { | 32 if (exe_path.BaseName() == FilePath(L"regsvr32.exe")) { |
33 return true; | 33 return true; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 // Failing that, it's some kind of install scenario, so the | 37 // Failing that, it's some kind of install scenario, so the |
38 // --enable-ceee flag must be provided. It should be ignored | 38 // --enable-ceee flag must be provided. It should be ignored |
39 // unless --chrome-frame is also specified, so we check for | 39 // unless --chrome-frame is also specified, so we check for |
40 // both. | 40 // both. |
41 // | 41 // |
42 // If check_firefox is true, the --enable-ff-ceee flag must | 42 // If check_firefox is true, the --enable-ff-ceee flag must |
43 // also be provided. | 43 // also be provided. |
44 CommandLine current_command_line(CommandLine::NO_PROGRAM); | 44 CommandLine current_command_line(CommandLine::NO_PROGRAM); |
45 current_command_line.ParseFromString(::GetCommandLine()); | 45 current_command_line.ParseFromString(::GetCommandLine()); |
46 if (current_command_line.HasSwitch(installer_util::switches::kEnableCeee) && | 46 if (current_command_line.HasSwitch(installer::switches::kEnableCeee) && |
47 current_command_line.HasSwitch(installer_util::switches::kChromeFrame) && | 47 current_command_line.HasSwitch(installer::switches::kChromeFrame) && |
48 (!check_firefox || current_command_line.HasSwitch( | 48 (!check_firefox || current_command_line.HasSwitch( |
49 installer_util::switches::kEnableFfCeee))) { | 49 installer::switches::kEnableFfCeee))) { |
50 return true; | 50 return true; |
51 } else { | 51 } else { |
52 return false; | 52 return false; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 bool ShouldRegisterCeee() { | 56 bool ShouldRegisterCeee() { |
57 return ShouldRegisterImpl(false); | 57 return ShouldRegisterImpl(false); |
58 } | 58 } |
59 | 59 |
60 bool ShouldRegisterFfCeee() { | 60 bool ShouldRegisterFfCeee() { |
61 return ShouldRegisterImpl(true); | 61 return ShouldRegisterImpl(true); |
62 } | 62 } |
63 | 63 |
64 } // namespace ceee_install_utils | 64 } // namespace ceee_install_utils |
OLD | NEW |