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/files/file_path_watcher.h"
11 #include "chrome/browser/chrome_browser_main.h"
19 // Handle uninstallation when given the appropriate the command-line switch.
20 // If |chrome_still_running| is true a modal dialog will be shown asking the
21 // user to close the other chrome instance.
22 int DoUninstallTasks(bool chrome_still_running
);
24 class ChromeBrowserMainPartsWin
: public ChromeBrowserMainParts
{
26 explicit ChromeBrowserMainPartsWin(
27 const content::MainFunctionParams
& parameters
);
29 ~ChromeBrowserMainPartsWin() override
;
31 // BrowserParts overrides.
32 void ToolkitInitialized() override
;
33 void PreMainMessageLoopStart() override
;
34 int PreCreateThreads() override
;
36 // ChromeBrowserMainParts overrides.
37 void ShowMissingLocaleMessageBox() override
;
38 void PostProfileInit() override
;
39 void PostBrowserStart() 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 base::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 base::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 base::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 #if defined(GOOGLE_CHROME_BUILD)
71 scoped_ptr
<DidRunUpdater
> did_run_updater_
;
74 // Cleans up Kasko crash reports that exceeded the maximum upload attempts.
75 base::FilePathWatcher failed_kasko_crash_report_watcher_
;
78 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsWin
);
81 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_