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_
12 #include "base/files/file_path_watcher.h"
13 #include "base/macros.h"
14 #include "chrome/browser/chrome_browser_main.h"
22 // Handle uninstallation when given the appropriate the command-line switch.
23 // If |chrome_still_running| is true a modal dialog will be shown asking the
24 // user to close the other chrome instance.
25 int DoUninstallTasks(bool chrome_still_running);
27 class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts {
29 ChromeBrowserMainPartsWin(const content::MainFunctionParams& parameters,
30 StartupData* startup_data);
32 ~ChromeBrowserMainPartsWin() override;
34 // BrowserParts overrides.
35 void ToolkitInitialized() override;
36 void PreMainMessageLoopStart() override;
37 int PreCreateThreads() override;
38 void PostMainMessageLoopRun() override;
40 // ChromeBrowserMainParts overrides.
41 void ShowMissingLocaleMessageBox() override;
42 void PostProfileInit() override;
43 void PostBrowserStart() override;
45 // Prepares the localized strings that are going to be displayed to
46 // the user if the browser process dies. These strings are stored in the
47 // environment block so they are accessible in the early stages of the
48 // chrome executable's lifetime.
49 static void PrepareRestartOnCrashEnviroment(
50 const base::CommandLine& parsed_command_line);
52 // Registers Chrome with the Windows Restart Manager, which will restore the
53 // Chrome session when the computer is restarted after a system update.
54 static void RegisterApplicationRestart(
55 const base::CommandLine& parsed_command_line);
57 // This method handles the --hide-icons and --show-icons command line options
58 // for chrome that get triggered by Windows from registry entries
59 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons
60 // functionality so we just ask the users if they want to uninstall Chrome.
61 static int HandleIconsCommands(const base::CommandLine& parsed_command_line);
63 // Checks if there is any machine level Chrome installed on the current
64 // machine. If yes and the current Chrome process is user level, uninstalls
65 // the user-level Chrome and susbsequently auto-launches the system-level
66 // Chrome. Returns true if the uninstall was kicked off and this process
68 static bool CheckMachineLevelInstall();
70 // Sets the TranslationDelegate which provides localized strings to
72 static void SetupInstallerUtilStrings();
75 // Watches module load events and forwards them to the ModuleDatabase.
76 std::unique_ptr<ModuleWatcher> module_watcher_;
78 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsWin);
81 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_