blob: 560631509f68da468aacba0ad4638f538d0d194d [file] [log] [blame]
[email protected]81ce2c42012-03-24 01:43:261// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]5c9587c2008-12-09 21:20:162// 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
[email protected]e6b5bc22011-09-08 22:01:567#ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_
8#define CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_
[email protected]5c9587c2008-12-09 21:20:169
Patrick Monette70c6860b2017-06-14 19:20:1510#include <memory>
11
erikwright0cdddbff2015-03-12 18:05:3412#include "base/files/file_path_watcher.h"
[email protected]e6b5bc22011-09-08 22:01:5613#include "chrome/browser/chrome_browser_main.h"
[email protected]f967b722011-09-07 00:58:0414
chrisha927d8fe2017-01-18 23:09:5115class ModuleWatcher;
grtaa9d8d22014-11-13 19:52:3616
[email protected]2f3b1cc2014-03-17 23:07:1517namespace base {
[email protected]5c9587c2008-12-09 21:20:1618class CommandLine;
[email protected]2f3b1cc2014-03-17 23:07:1519}
[email protected]5c9587c2008-12-09 21:20:1620
[email protected]5c9587c2008-12-09 21:20:1621// Handle uninstallation when given the appropriate the command-line switch.
[email protected]53c38d232009-02-13 20:52:1822// If |chrome_still_running| is true a modal dialog will be shown asking the
23// user to close the other chrome instance.
24int DoUninstallTasks(bool chrome_still_running);
[email protected]5c9587c2008-12-09 21:20:1625
[email protected]e6b5bc22011-09-08 22:01:5626class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts {
[email protected]f967b722011-09-07 00:58:0427 public:
Xi Han85079c22019-04-18 21:43:0528 ChromeBrowserMainPartsWin(const content::MainFunctionParams& parameters,
29 StartupData* startup_data);
David Bienvenu1fafcf32020-07-01 00:33:4230 ChromeBrowserMainPartsWin(const ChromeBrowserMainPartsWin&) = delete;
31 ChromeBrowserMainPartsWin& operator=(const ChromeBrowserMainPartsWin&) =
32 delete;
nickddb02ac2015-04-24 20:45:3833 ~ChromeBrowserMainPartsWin() override;
[email protected]b83575d2012-04-25 18:35:0834
[email protected]b48c9182011-10-26 18:03:3035 // BrowserParts overrides.
nickddb02ac2015-04-24 20:45:3836 void ToolkitInitialized() override;
37 void PreMainMessageLoopStart() override;
38 int PreCreateThreads() override;
Greg Thompsondfc7d7f42020-05-14 19:30:5039 void PostMainMessageLoopRun() override;
[email protected]b48c9182011-10-26 18:03:3040
41 // ChromeBrowserMainParts overrides.
nickddb02ac2015-04-24 20:45:3842 void ShowMissingLocaleMessageBox() override;
43 void PostProfileInit() override;
44 void PostBrowserStart() override;
[email protected]b48c9182011-10-26 18:03:3045
46 // Prepares the localized strings that are going to be displayed to
47 // the user if the browser process dies. These strings are stored in the
48 // environment block so they are accessible in the early stages of the
49 // chrome executable's lifetime.
50 static void PrepareRestartOnCrashEnviroment(
[email protected]2f3b1cc2014-03-17 23:07:1551 const base::CommandLine& parsed_command_line);
[email protected]b48c9182011-10-26 18:03:3052
53 // Registers Chrome with the Windows Restart Manager, which will restore the
54 // Chrome session when the computer is restarted after a system update.
55 static void RegisterApplicationRestart(
[email protected]2f3b1cc2014-03-17 23:07:1556 const base::CommandLine& parsed_command_line);
[email protected]b48c9182011-10-26 18:03:3057
58 // This method handles the --hide-icons and --show-icons command line options
59 // for chrome that get triggered by Windows from registry entries
60 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons
61 // functionality so we just ask the users if they want to uninstall Chrome.
[email protected]2f3b1cc2014-03-17 23:07:1562 static int HandleIconsCommands(const base::CommandLine& parsed_command_line);
[email protected]b48c9182011-10-26 18:03:3063
gabc535d222015-12-15 22:00:1564 // Checks if there is any machine level Chrome installed on the current
65 // machine. If yes and the current Chrome process is user level, uninstalls
66 // the user-level Chrome and susbsequently auto-launches the system-level
67 // Chrome. Returns true if the uninstall was kicked off and this process
68 // should exit.
[email protected]b48c9182011-10-26 18:03:3069 static bool CheckMachineLevelInstall();
[email protected]81ce2c42012-03-24 01:43:2670
[email protected]b4d08ea2012-05-24 19:26:5771 // Sets the TranslationDelegate which provides localized strings to
72 // installer_util.
73 static void SetupInstallerUtilStrings();
74
David Bienvenu1fafcf32020-07-01 00:33:4275 // Return a |command_line| copy modified to restore the session after Windows
76 // updates. Removes URL args, unnecessary switches, and the program name.
77 static base::CommandLine GetRestartCommandLine(
78 const base::CommandLine& command_line);
79
[email protected]81ce2c42012-03-24 01:43:2680 private:
Patrick Monette70c6860b2017-06-14 19:20:1581 // Watches module load events and forwards them to the ModuleDatabase.
chrisha927d8fe2017-01-18 23:09:5182 std::unique_ptr<ModuleWatcher> module_watcher_;
[email protected]f967b722011-09-07 00:58:0483};
84
[email protected]e6b5bc22011-09-08 22:01:5685#endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_