Don't crash when SimpleCache index is corrupt.
[chromium-blink-merge.git] / chrome / browser / chrome_browser_main_win.h
blobe3dabae9b4a2b6a1a49c707873d1d2e1f2493aa9
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"
13 class CommandLine;
15 namespace chrome {
16 class StorageMonitorWin;
17 } // namespace chrome
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 {
26 public:
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 PreProfileInit() OVERRIDE;
37 // ChromeBrowserMainParts overrides.
38 virtual void ShowMissingLocaleMessageBox() OVERRIDE;
40 // Prepares the localized strings that are going to be displayed to
41 // the user if the browser process dies. These strings are stored in the
42 // environment block so they are accessible in the early stages of the
43 // chrome executable's lifetime.
44 static void PrepareRestartOnCrashEnviroment(
45 const CommandLine& parsed_command_line);
47 // Registers Chrome with the Windows Restart Manager, which will restore the
48 // Chrome session when the computer is restarted after a system update.
49 static void RegisterApplicationRestart(
50 const CommandLine& parsed_command_line);
52 // This method handles the --hide-icons and --show-icons command line options
53 // for chrome that get triggered by Windows from registry entries
54 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons
55 // functionality so we just ask the users if they want to uninstall Chrome.
56 static int HandleIconsCommands(const CommandLine& parsed_command_line);
58 // Check if there is any machine level Chrome installed on the current
59 // machine. If yes and the current Chrome process is user level, we do not
60 // allow the user level Chrome to run. So we notify the user and uninstall
61 // user level Chrome.
62 static bool CheckMachineLevelInstall();
64 // Sets the TranslationDelegate which provides localized strings to
65 // installer_util.
66 static void SetupInstallerUtilStrings();
68 private:
69 scoped_ptr<chrome::StorageMonitorWin> storage_monitor_;
71 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsWin);
74 #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_