| 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 at user login. |
| 15 namespace auto_launch_util { | 15 namespace auto_launch_util { |
| 16 | 16 |
| 17 // Returns whether the Chrome executable specified in |application_path| is set | 17 // Returns whether the Chrome executable in the directory |application_path| is |
| 18 // to auto-launch at computer startup. NOTE: |application_path| is optional and | 18 // set to auto-start at user login. |
| 19 // should be blank in most cases (as it will default to the application path of | 19 // |profile_directory| is the name of the directory (leaf, not the full path) |
| 20 // the current executable). |profile_directory| is the name of the directory | 20 // that contains the profile that should be opened at user login. |
| 21 // (leaf, not the full path) that contains the profile that should be opened at | 21 // There are two flavors of auto-start, separated by whether a window is |
| 22 // computer startup. | 22 // requested at startup or not (called background mode). |window_requested| |
| 23 bool WillLaunchAtLogin(const FilePath& application_path, | 23 // specifies which flavor the caller is interested in. |
| 24 const string16& profile_directory); | 24 // NOTE: This function returns true only if the flavor the caller specifies has |
| 25 // been requested (or if both flavors have been requested). Therefore, it is |
| 26 // possible that Chrome auto-starts even if this function returns false (since |
| 27 // the other flavor might have been requested). |
| 28 // NOTE: Chrome being set to launch in the background (without a window) |
| 29 // does not necessarily mean that Chrome *will* launch without a window, since |
| 30 // when both flavors of the auto-start feature have been requested. In other |
| 31 // words, showing a window trumps not showing a window. |
| 32 // ALSO NOTE: |application_path| is optional and should be blank in most cases |
| 33 // (as it will default to the application path of the current executable). |
| 34 bool AutoStartRequested(const string16& profile_directory, |
| 35 bool window_requested, |
| 36 const FilePath& application_path); |
| 25 | 37 |
| 26 // Configures whether the Chrome executable should auto-launch at computer | 38 // Disables all auto-start features. |profile_directory| is the name of the |
| 27 // startup. |application_path| is needed when |auto_launch| is true AND when | 39 // directory (leaf, not the full path) that contains the profile that was set |
| 28 // the caller is not the process being set to auto-launch, ie. the installer. | 40 // to be opened at user login. |
| 29 // This is because |application_path|, if left blank, defaults to the | 41 void DisableAllAutoStartFeatures(const string16& profile_directory); |
| 30 // application path of the current executable. If |auto_launch| is true, then it | 42 |
| 31 // will auto-launch, otherwise it will be configured not to. |profile_directory| | 43 // Configures Chrome to auto-launch at user login and show a window. See also |
| 32 // is the name of the directory (leaf, not the full path) that contains the | 44 // EnableBackgroundStartAtLogin, which does the same, except without a window. |
| 33 // profile that should be opened at computer startup. | 45 // |profile_directory| is the name of the directory (leaf, not the full path) |
| 34 void SetWillLaunchAtLogin(bool auto_launch, | 46 // that contains the profile that should be opened at user login. |
| 35 const FilePath& application_path, | 47 // |application_path| is needed when the caller is not the process being set to |
| 36 const string16& profile_directory); | 48 // auto-launch, ie. the installer. This is because |application_path|, if left |
| 49 // blank, defaults to the application path of the current executable. |
| 50 void EnableForegroundStartAtLogin(const string16& profile_directory, |
| 51 const FilePath& application_path); |
| 52 |
| 53 // Disables auto-starting Chrome in foreground mode at user login. |
| 54 // |profile_directory| is the name of the directory (leaf, not the full path) |
| 55 // that contains the profile that was set to be opened at user login. |
| 56 // NOTE: Chrome may still launch if the other auto-start flavor is active |
| 57 // (background mode). |
| 58 void DisableForegroundStartAtLogin(const string16& profile_directory); |
| 59 |
| 60 // Requests that Chrome start in Background Mode at user login (without a |
| 61 // window being shown, except if EnableForegroundStartAtLogin has also been |
| 62 // called). |
| 63 // In short, EnableBackgroundStartAtLogin is the no-window version of calling |
| 64 // EnableForegroundStartAtLogin). If both are called, a window will be shown on |
| 65 // startup (foreground mode wins). |
| 66 void EnableBackgroundStartAtLogin(); |
| 67 |
| 68 // Disables auto-starting Chrome in background mode at user login. Chrome may |
| 69 // still launch if the other auto-start flavor is active (foreground mode). |
| 70 void DisableBackgroundStartAtLogin(); |
| 37 | 71 |
| 38 } // namespace auto_launch_util | 72 } // namespace auto_launch_util |
| 39 | 73 |
| 40 #endif // CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ | 74 #endif // CHROME_INSTALLER_UTIL_AUTO_LAUNCH_UTIL_H_ |
| OLD | NEW |