Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: chrome/installer/util/shell_util.h

Issue 6961013: Allow chrome to become the os default handler for arbitrary protocols on mac/win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/shell_util.h
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index b34f4f6da36f3d2898d6902f25332b3935ae78e6..7ffbb5771c8fb76ee53d54c7cd2edf7150d201a3 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -30,6 +30,9 @@ class ShellUtil {
SYSTEM_LEVEL = 0x2 // Make any shell changes only at the system level
};
+ // Relative path of the URL Protocol registry entry (prefixed with '\').
+ static const wchar_t* kRegURLProtocol;
+
// Relative path of DefaultIcon registry entry (prefixed with '\').
static const wchar_t* kRegDefaultIcon;
@@ -69,8 +72,12 @@ class ShellUtil {
// File extensions that Chrome registers itself for.
static const wchar_t* kFileAssociations[];
- // Protocols that Chrome registers itself for.
- static const wchar_t* kProtocolAssociations[];
+ // Protocols that Chrome registers itself as the default handler for
+ // when the user makes Chrome the default browser.
+ static const wchar_t* kBrowserProtocolAssociations[];
+
+ // Protocols that Chrome registers itself as being capable of handling.
+ static const wchar_t* kPotentialProtocolAssociations[];
// Registry value name that is needed for ChromeHTML ProgId
static const wchar_t* kRegUrlProtocol;
@@ -168,6 +175,14 @@ class ShellUtil {
const std::wstring& chrome_exe,
bool elevate_if_not_admin);
+ // Make Chrome default application for a protocol.
+ // chrome_exe: The chrome.exe path to register as default browser.
+ // elevate_if_not_admin: On Vista if user is not admin, try to elevate for
+ // Chrome registration.
+ static bool MakeChromeDefaultProtocolClient(BrowserDistribution* dist,
+ const std::wstring& chrome_exe,
+ const std::wstring& protocol);
+
// This method adds Chrome to the list that shows up in Add/Remove Programs->
// Set Program Access and Defaults and also creates Chrome ProgIds under
// Software\Classes. This method requires write access to HKLM so is just
@@ -194,6 +209,27 @@ class ShellUtil {
const std::wstring& unique_suffix,
bool elevate_if_not_admin);
+ // This method declares to Windows that Chrome is capable of handling the
+ // given protocol. If necessary it will also call RegisterChromeBrowser above.
+ // Declaring the capability of handling a protocol is necessary to register
+ // as the default handler for the protocol is Vista and later versions of
+ // Windows.
+ //
+ // If called by the browser and elevation is required, it will elevate by
+ // calling setup.exe which will again call this function with elevate false.
+ //
+ // |chrome_exe| full path to chrome.exe.
+ // |unique_suffix| Optional input. If given, this function appends the value
+ // to default browser entries names that it creates in the registry.
+ // |protocol| The protocol to register as being capable of handling.s
+ // |elevate_if_not_admin| if true will make this method try alternate methods
+ // as described above.
+ static bool RegisterChromeForProtocol(BrowserDistribution* dist,
+ const std::wstring& chrome_exe,
+ const std::wstring& unique_suffix,
+ const std::wstring& protocol,
+ bool elevate_if_not_admin);
+
// Remove Chrome shortcut from Desktop.
// If shell_change is CURRENT_USER, the shortcut is removed from the
// Desktop folder of current user's profile.

Powered by Google App Engine
This is Rietveld 408576698