OLD | NEW |
1 // Copyright (c) 2011 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/mini_installer/configuration.h" | 5 #include "chrome/installer/mini_installer/configuration.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> // NOLINT | 8 #include <shellapi.h> // NOLINT |
9 | 9 |
10 #include "chrome/installer/mini_installer/appid.h" | 10 #include "chrome/installer/mini_installer/appid.h" |
11 | 11 |
(...skipping 15 matching lines...) Expand all Loading... |
27 if (args_ != NULL) { | 27 if (args_ != NULL) { |
28 ::LocalFree(args_); | 28 ::LocalFree(args_); |
29 args_ = NULL; | 29 args_ = NULL; |
30 } | 30 } |
31 chrome_app_guid_ = google_update::kAppGuid; | 31 chrome_app_guid_ = google_update::kAppGuid; |
32 command_line_ = NULL; | 32 command_line_ = NULL; |
33 operation_ = INSTALL_PRODUCT; | 33 operation_ = INSTALL_PRODUCT; |
34 argument_count_ = 0; | 34 argument_count_ = 0; |
35 has_chrome_ = false; | 35 has_chrome_ = false; |
36 has_chrome_frame_ = false; | 36 has_chrome_frame_ = false; |
| 37 has_app_host_ = false; |
37 is_multi_install_ = false; | 38 is_multi_install_ = false; |
38 is_system_level_ = false; | 39 is_system_level_ = false; |
39 } | 40 } |
40 | 41 |
41 bool Configuration::Initialize() { | 42 bool Configuration::Initialize() { |
42 return InitializeFromCommandLine(::GetCommandLine()); | 43 return InitializeFromCommandLine(::GetCommandLine()); |
43 } | 44 } |
44 | 45 |
45 // This is its own function so that unit tests can provide their own command | 46 // This is its own function so that unit tests can provide their own command |
46 // lines. |command_line| is shared with this instance in the sense that this | 47 // lines. |command_line| is shared with this instance in the sense that this |
47 // instance may refer to it at will throughout its lifetime, yet it will | 48 // instance may refer to it at will throughout its lifetime, yet it will |
48 // not release it. | 49 // not release it. |
49 bool Configuration::InitializeFromCommandLine(const wchar_t* command_line) { | 50 bool Configuration::InitializeFromCommandLine(const wchar_t* command_line) { |
50 Clear(); | 51 Clear(); |
51 | 52 |
52 command_line_ = command_line; | 53 command_line_ = command_line; |
53 args_ = ::CommandLineToArgvW(command_line_, &argument_count_); | 54 args_ = ::CommandLineToArgvW(command_line_, &argument_count_); |
54 if (args_ != NULL) { | 55 if (args_ != NULL) { |
55 for (int i = 1; i < argument_count_; ++i) { | 56 for (int i = 1; i < argument_count_; ++i) { |
56 if (0 == ::lstrcmpi(args_[i], L"--chrome-sxs")) | 57 if (0 == ::lstrcmpi(args_[i], L"--chrome-sxs")) |
57 chrome_app_guid_ = google_update::kSxSAppGuid; | 58 chrome_app_guid_ = google_update::kSxSAppGuid; |
58 else if (0 == ::lstrcmpi(args_[i], L"--chrome")) | 59 else if (0 == ::lstrcmpi(args_[i], L"--chrome")) |
59 has_chrome_ = true; | 60 has_chrome_ = true; |
60 else if (0 == ::lstrcmpi(args_[i], L"--chrome-frame")) | 61 else if (0 == ::lstrcmpi(args_[i], L"--chrome-frame")) |
61 has_chrome_frame_ = true; | 62 has_chrome_frame_ = true; |
| 63 else if (0 == ::lstrcmpi(args_[i], L"--app-host")) |
| 64 has_app_host_ = true; |
62 else if (0 == ::lstrcmpi(args_[i], L"--multi-install")) | 65 else if (0 == ::lstrcmpi(args_[i], L"--multi-install")) |
63 is_multi_install_ = true; | 66 is_multi_install_ = true; |
64 else if (0 == ::lstrcmpi(args_[i], L"--system-level")) | 67 else if (0 == ::lstrcmpi(args_[i], L"--system-level")) |
65 is_system_level_ = true; | 68 is_system_level_ = true; |
66 else if (0 == ::lstrcmpi(args_[i], L"--cleanup")) | 69 else if (0 == ::lstrcmpi(args_[i], L"--cleanup")) |
67 operation_ = CLEANUP; | 70 operation_ = CLEANUP; |
68 } | 71 } |
69 | 72 |
70 // Single-install is either Chrome or Chrome Frame. | 73 // Single-install defaults to Chrome. |
71 if (!is_multi_install_) | 74 if (!is_multi_install_) |
72 has_chrome_ = !has_chrome_frame_; | 75 has_chrome_ = !(has_chrome_frame_ || has_app_host_); |
73 } | 76 } |
74 return args_ != NULL; | 77 return args_ != NULL; |
75 } | 78 } |
76 | 79 |
77 } // namespace mini_installer | 80 } // namespace mini_installer |
OLD | NEW |