Index: chrome/installer/util/shell_registry_util.h |
diff --git a/chrome/installer/util/shell_registry_util.h b/chrome/installer/util/shell_registry_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..60d5375322127326954388a5087ec5964351720d |
--- /dev/null |
+++ b/chrome/installer/util/shell_registry_util.h |
@@ -0,0 +1,146 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_INSTALLER_UTIL_SHELL_REGISTRY_UTIL_H_ |
+#define CHROME_INSTALLER_UTIL_SHELL_REGISTRY_UTIL_H_ |
+ |
+#include "base/files/file_path.h" |
+#include "base/memory/scoped_vector.h" |
+#include "base/strings/string16.h" |
+ |
+class BrowserDistribution; |
+class RegistryEntry; |
+ |
+namespace installer_util { |
+ |
+extern const wchar_t kReinstallCommand[]; |
+ |
+// Details about a Windows application, to be entered into the registry for the |
+// purpose of file associations. |
+struct ApplicationInfo { |
+ ApplicationInfo() : file_type_icon_index(0), application_icon_index(0) {} |
+ |
+ // The ProgId used by Windows for file associations with this application. |
+ // Must not be empty or start with a '.'. |
+ base::string16 prog_id; |
+ // The friendly name, and the path of the icon that will be used for files of |
+ // these types when associated with this application by default. (They are NOT |
+ // the name/icon that will represent the application under the Open With |
+ // menu.) |
+ base::string16 file_type_name; |
+ base::FilePath file_type_icon_path; |
+ int file_type_icon_index; |
+ // The command to execute when opening a file via this association. It should |
+ // contain "%1" (to tell Windows to pass the filename as an argument). |
+ // TODO(mgiuca): |command_line| should be a base::CommandLine. |
+ base::string16 command_line; |
+ // The AppUserModelId used by Windows 8 for this application. Distinct from |
+ // |prog_id|. |
+ base::string16 app_id; |
+ |
+ // User-visible details about this application. Any of these may be empty. |
+ base::string16 application_name; |
+ base::FilePath application_icon_path; |
+ int application_icon_index; |
+ base::string16 application_description; |
+ base::string16 publisher_name; |
+ |
+ // The CLSID for the application's DelegateExecute handler. May be empty. |
+ base::string16 delegate_clsid; |
+}; |
+ |
+// Returns the Windows browser client registration key for Chrome. For example: |
+// "Software\Clients\StartMenuInternet\Chromium[.user]". Strictly speaking, we |
+// should use the name of the executable (e.g., "chrome.exe"), but that ship has |
+// sailed. The cost of switching now is re-prompting users to make Chrome their |
+// default browser, which isn't polite. |suffix| is the user-specific |
+// registration suffix; see GetUserSpecificDefaultBrowserSuffix in shell_util.h |
+// for details. |
+base::string16 GetBrowserClientKey(BrowserDistribution* dist, |
+ const base::string16& suffix); |
+ |
+// Gets the registry entries to register an application in the Windows registry. |
+// |app_info| provides all of the information needed. |
+void GetProgIdEntries(const ApplicationInfo& app_info, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// This method returns a list of all the registry entries that are needed to |
+// register this installation's ProgId and AppId. These entries need to be |
+// registered in HKLM prior to Win8. |
+void GetChromeProgIdEntries(BrowserDistribution* dist, |
+ const base::FilePath& chrome_exe, |
+ const base::string16& suffix, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// This method returns a list of the registry entries needed to declare a |
+// capability of handling a protocol on Windows. |
+void GetProtocolCapabilityEntries(BrowserDistribution* dist, |
+ const base::string16& suffix, |
+ const base::string16& protocol, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// This method returns a list of the registry entries required to register this |
+// installation in "RegisteredApplications" on Windows (to appear in Default |
+// Programs, StartMenuInternet, etc.). These entries need to be registered in |
+// HKLM prior to Win8. If |suffix| is not empty, these entries are guaranteed to |
+// be unique on this machine. |
+void GetShellIntegrationEntries(BrowserDistribution* dist, |
+ const base::FilePath& chrome_exe, |
+ const base::string16& suffix, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// Gets the registry entries to register an application as a handler for a |
+// particular file extension. |prog_id| is the ProgId used by Windows for the |
+// application. |ext| is the file extension, which must begin with a '.'. |
+void GetAppExtRegistrationEntries(const base::string16& prog_id, |
+ const base::string16& ext, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// This method returns a list of the registry entries required for this |
+// installation to be registered in the Windows shell. |
+// In particular: |
+// - App Paths |
+// http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 |
+// - File Associations |
+// http://msdn.microsoft.com/en-us/library/bb166549 |
+// These entries need to be registered in HKLM prior to Win8. |
+void GetChromeAppRegistrationEntries(const base::FilePath& chrome_exe, |
+ const base::string16& suffix, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// Gets the registry entries to register an application as the default handler |
+// for a particular file extension. |prog_id| is the ProgId used by Windows for |
+// the application. |ext| is the file extension, which must begin with a '.'. If |
+// |overwrite_existing|, always sets the default handler; otherwise only sets if |
+// there is no existing default. |
+// |
+// This has no effect on Windows 8. Windows 8 ignores the default and lets the |
+// user choose. If there is only one handler for a file, it will automatically |
+// become the default. Otherwise, the first time the user opens a file, they are |
+// presented with the dialog to set the default handler. (This is roughly |
+// equivalent to being called with |overwrite_existing| false.) |
+void GetAppDefaultRegistrationEntries(const base::string16& prog_id, |
+ const base::string16& ext, |
+ bool overwrite_existing, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// This method returns a list of all the user level registry entries that are |
+// needed to make Chromium the default handler for a protocol on XP. |
+void GetXPStyleUserProtocolEntries(const base::string16& protocol, |
+ const base::string16& chrome_icon, |
+ const base::string16& chrome_open, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+// This method returns a list of all the user level registry entries that are |
+// needed to make Chromium default browser on XP. Some of these entries are |
+// irrelevant in recent versions of Windows, but we register them anyways as |
+// some legacy apps are hardcoded to lookup those values. |
+void GetXPStyleDefaultBrowserUserEntries(BrowserDistribution* dist, |
+ const base::FilePath& chrome_exe, |
+ const base::string16& suffix, |
+ ScopedVector<RegistryEntry>* entries); |
+ |
+} // namespace installer_util |
+ |
+#endif // CHROME_INSTALLER_UTIL_SHELL_REGISTRY_UTIL_H_ |