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