| OLD | NEW |
| 1 // Copyright (c) 2012 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 #ifndef CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ |
| 6 #define CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ | 6 #define CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 | 10 |
| 11 class FilePath; | 11 class FilePath; |
| 12 | 12 |
| 13 // A namespace containing the platform specific implementation of setting Chrome | 13 // A namespace containing the platform specific implementation of setting Chrome |
| 14 // to launch on computer startup. | 14 // to launch on computer startup. |
| 15 namespace auto_launch_util { | 15 namespace auto_launch_util { |
| 16 | 16 |
| 17 // We use one Run key with flags specifying which feature we want to start up. |
| 18 // When we change our Run key we need to specify what we want to do with each |
| 19 // flag. This lists the possible actions we can take with the flags. |
| 20 enum FlagSetting { |
| 21 FLAG_DISABLE, // Disable the flag. |
| 22 FLAG_ENABLE, // Enable the flag. |
| 23 FLAG_PRESERVE, // Preserve the value that the flag has currently. |
| 24 }; |
| 25 |
| 17 // Returns whether the Chrome executable specified in |application_path| is set | 26 // Returns whether the Chrome executable specified in |application_path| is set |
| 18 // to auto-launch at computer startup. NOTE: |application_path| is optional and | 27 // to auto-launch at computer startup with a given |command_line_switch|. |
| 19 // should be blank in most cases (as it will default to the application path of | 28 // NOTE: |application_path| is optional and should be blank in most cases (as |
| 20 // the current executable). |profile_directory| is the name of the directory | 29 // it will default to the application path of the current executable). |
| 21 // (leaf, not the full path) that contains the profile that should be opened at | 30 // |profile_directory| is the name of the directory (leaf, not the full path) |
| 22 // computer startup. | 31 // that contains the profile that should be opened at computer startup. |
| 23 bool WillLaunchAtLogin(const FilePath& application_path, | 32 // |command_line_switch| is the switch we are optionally interested in and, if |
| 24 const string16& profile_directory); | 33 // not blank, must be present for the function to return true. |
| 34 bool WillLaunchAtLoginWithSwitch(const FilePath& application_path, |
| 35 const string16& profile_directory, |
| 36 const std::string& command_line_switch); |
| 25 | 37 |
| 26 // Configures whether the Chrome executable should auto-launch at computer | 38 // Configures which flag should be present when the Chrome executable |
| 27 // startup. |application_path| is needed when |auto_launch| is true AND when | 39 // auto-launches at computer startup. |application_path| is needed when one or |
| 28 // the caller is not the process being set to auto-launch, ie. the installer. | 40 // more flags is being set AND when the caller is not the process being set to |
| 29 // This is because |application_path|, if left blank, defaults to the | 41 // auto-launch, ie. the installer. This is because |application_path|, if left |
| 30 // application path of the current executable. If |auto_launch| is true, then it | 42 // blank, defaults to the application path of the current executable. |
| 31 // will auto-launch, otherwise it will be configured not to. |profile_directory| | 43 // |profile_directory| is the name of the directory (leaf, not the full path) |
| 32 // is the name of the directory (leaf, not the full path) that contains the | 44 // that contains the profile that should be opened at computer startup. |
| 33 // profile that should be opened at computer startup. | 45 // |auto_start_feature| is the feature that launches Chrome with a window at |
| 34 void SetWillLaunchAtLogin(bool auto_launch, | 46 // computer startup. |background_mode| launches Chrome in the background without |
| 35 const FilePath& application_path, | 47 // a window. If both |background_mode| and |auto_start_feature| are enabled, the |
| 36 const string16& profile_directory); | 48 // |auto_start_feature| will win and a window will be shown. We don't remove the |
| 49 // |background_mode| flag when |auto_start_feature| is turned on because the |
| 50 // user might turn off auto_start at any time from the settings page, leaving |
| 51 // only |background_mode|. |
| 52 void SetWillLaunchAtLogin(const FilePath& application_path, |
| 53 const string16& profile_directory, |
| 54 FlagSetting auto_start_feature, |
| 55 FlagSetting background_mode); |
| 37 | 56 |
| 38 } // namespace auto_launch_util | 57 } // namespace auto_launch_util |
| 39 | 58 |
| 40 #endif // CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ | 59 #endif // CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ |
| OLD | NEW |