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