15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace mini_installer { 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A simple container of the mini_installer's configuration, as dictated by the 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// command line used to invoke it. 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Configuration { 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum Operation { 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) INSTALL_PRODUCT, 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CLEANUP, 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Configuration(); 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ~Configuration(); 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Initializes this instance on the basis of the process's command line. 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool Initialize(); 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the desired operation dictated by the command line options. 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Operation operation() const { return operation_; } 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the program portion of the command line, or NULL if it cannot be 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // determined (e.g., by misuse). 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const wchar_t* program() const; 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the number of arguments specified on the command line, including 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the program itself. 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int argument_count() const { return argument_count_; } 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the original command line. 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const wchar_t* command_line() const { return command_line_; } 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the app guid to be used for Chrome. --chrome-sxs on the command 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // line makes this the canary's app guid. 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const wchar_t* chrome_app_guid() const { return chrome_app_guid_; } 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if --chrome is explicitly or implicitly on the command line. 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool has_chrome() const { return has_chrome_; } 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if --chrome-frame is on the command line. 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool has_chrome_frame() const { return has_chrome_frame_; } 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if --app-host is on the command line. 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool has_app_host() const { return has_app_host_; } 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if --multi-install is on the command line. 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool is_multi_install() const { return is_multi_install_; } 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if --system-level is on the command line. 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool is_system_level() const { return is_system_level_; } 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void Clear(); 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool InitializeFromCommandLine(const wchar_t* command_line); 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) wchar_t** args_; 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const wchar_t* chrome_app_guid_; 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const wchar_t* command_line_; 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int argument_count_; 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Operation operation_; 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool has_chrome_; 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool has_chrome_frame_; 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool has_app_host_; 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool is_multi_install_; 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool is_system_level_; 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Configuration(const Configuration&); 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Configuration& operator=(const Configuration&); 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace mini_installer 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_INSTALLER_MINI_INSTALLER_CONFIGURATION_H_ 81