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