| 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 { | 16 namespace installer { |
| 17 namespace switches { | 17 namespace switches { |
| 18 // TODO(joi@chromium.org) Move to chrome/installer/util_constants.h | 18 // TODO(joi): 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[] = "ceee"; |
| 22 // TODO(joi): The installer supports only "ceee". |
| 22 const char kEnableFfCeee[] = "enable-ff-ceee"; | 23 const char kEnableFfCeee[] = "enable-ff-ceee"; |
| 23 } | 24 } |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace ceee_install_utils { | 27 namespace ceee_install_utils { |
| 27 | 28 |
| 28 bool ShouldRegisterImpl(bool check_firefox) { | 29 bool ShouldRegisterImpl(bool check_firefox) { |
| 29 // First check if it's a developer running us explicitly. | 30 // First check if it's a developer running us explicitly. |
| 30 FilePath exe_path; | 31 FilePath exe_path; |
| 31 if (PathService::Get(base::FILE_EXE, &exe_path)) { | 32 if (PathService::Get(base::FILE_EXE, &exe_path)) { |
| 32 if (exe_path.BaseName() == FilePath(L"regsvr32.exe")) { | 33 if (exe_path.BaseName() == FilePath(L"regsvr32.exe")) { |
| 33 return true; | 34 return true; |
| 34 } | 35 } |
| 35 } | 36 } |
| 36 | 37 |
| 37 // Failing that, it's some kind of install scenario, so the | 38 // Failing that, it's some kind of install scenario, so the |
| 38 // --enable-ceee flag must be provided. It should be ignored | 39 // --ceee flag must be provided. It should be ignored |
| 39 // unless --chrome-frame is also specified, so we check for | 40 // unless --chrome-frame is also specified, so we check for |
| 40 // both. | 41 // both. |
| 41 // | 42 // |
| 42 // If check_firefox is true, the --enable-ff-ceee flag must | 43 // If check_firefox is true, the --enable-ff-ceee flag must |
| 43 // also be provided. | 44 // also be provided. |
| 44 CommandLine current_command_line(CommandLine::NO_PROGRAM); | 45 CommandLine current_command_line(CommandLine::NO_PROGRAM); |
| 45 current_command_line.ParseFromString(::GetCommandLine()); | 46 current_command_line.ParseFromString(::GetCommandLine()); |
| 46 if (current_command_line.HasSwitch(installer::switches::kEnableCeee) && | 47 if (current_command_line.HasSwitch(installer::switches::kEnableCeee) && |
| 47 current_command_line.HasSwitch(installer::switches::kChromeFrame) && | 48 current_command_line.HasSwitch(installer::switches::kChromeFrame) && |
| 48 (!check_firefox || current_command_line.HasSwitch( | 49 (!check_firefox || current_command_line.HasSwitch( |
| 49 installer::switches::kEnableFfCeee))) { | 50 installer::switches::kEnableFfCeee))) { |
| 50 return true; | 51 return true; |
| 51 } else { | 52 } else { |
| 52 return false; | 53 return false; |
| 53 } | 54 } |
| 54 } | 55 } |
| 55 | 56 |
| 56 bool ShouldRegisterCeee() { | 57 bool ShouldRegisterCeee() { |
| 57 return ShouldRegisterImpl(false); | 58 return ShouldRegisterImpl(false); |
| 58 } | 59 } |
| 59 | 60 |
| 60 bool ShouldRegisterFfCeee() { | 61 bool ShouldRegisterFfCeee() { |
| 61 return ShouldRegisterImpl(true); | 62 return ShouldRegisterImpl(true); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace ceee_install_utils | 65 } // namespace ceee_install_utils |
| OLD | NEW |