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 // Contains functions used by BrowserMain() that are win32-specific. 6 7 #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_ 8 #define CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_ 9 10 #include "chrome/browser/chrome_browser_main.h" 11 12 namespace base { 13 class CommandLine; 14 } 15 16 // Handle uninstallation when given the appropriate the command-line switch. 17 // If |chrome_still_running| is true a modal dialog will be shown asking the 18 // user to close the other chrome instance. 19 int DoUninstallTasks(bool chrome_still_running); 20 21 class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts { 22 public: 23 explicit ChromeBrowserMainPartsWin( 24 const content::MainFunctionParams& parameters); 25 26 virtual ~ChromeBrowserMainPartsWin(); 27 28 // BrowserParts overrides. 29 virtual void ToolkitInitialized() OVERRIDE; 30 virtual void PreMainMessageLoopStart() OVERRIDE; 31 virtual int PreCreateThreads() OVERRIDE; 32 33 // ChromeBrowserMainParts overrides. 34 virtual void ShowMissingLocaleMessageBox() OVERRIDE; 35 virtual void PostBrowserStart() OVERRIDE; 36 37 // Prepares the localized strings that are going to be displayed to 38 // the user if the browser process dies. These strings are stored in the 39 // environment block so they are accessible in the early stages of the 40 // chrome executable's lifetime. 41 static void PrepareRestartOnCrashEnviroment( 42 const base::CommandLine& parsed_command_line); 43 44 // Registers Chrome with the Windows Restart Manager, which will restore the 45 // Chrome session when the computer is restarted after a system update. 46 static void RegisterApplicationRestart( 47 const base::CommandLine& parsed_command_line); 48 49 // This method handles the --hide-icons and --show-icons command line options 50 // for chrome that get triggered by Windows from registry entries 51 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons 52 // functionality so we just ask the users if they want to uninstall Chrome. 53 static int HandleIconsCommands(const base::CommandLine& parsed_command_line); 54 55 // Check if there is any machine level Chrome installed on the current 56 // machine. If yes and the current Chrome process is user level, we do not 57 // allow the user level Chrome to run. So we notify the user and uninstall 58 // user level Chrome. 59 static bool CheckMachineLevelInstall(); 60 61 // Sets the TranslationDelegate which provides localized strings to 62 // installer_util. 63 static void SetupInstallerUtilStrings(); 64 65 private: 66 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsWin); 67 }; 68 69 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_ 70