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