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